sql-server-2016

SQL Server 2016 CTRP3.2 Report Viewer is missing a JavaScript method

ⅰ亾dé卋堺 提交于 2019-12-19 04:12:39
问题 Using SQL Server 2016 CTP3.2 Report Viewer (13.0.800.111), only the toolbar is shown. It looks like a Power BI method is missing. Also, will there be a NuGet for Report Viewer? 回答1: Just ran across this thread. The question: "will there be a NuGet for Report Viewer?" -- Yes, look out for a NuGet version of 2016 based report viewer controls this month (September). Note that the controls will not expose the PowerBI method described here. 回答2: To overcome broken report viewer you have to purge

C# Dapper using JSON_VALUE for SQL Server 2016

空扰寡人 提交于 2019-12-19 03:24:10
问题 I want to query data from my table using JSON_VALUE : var str = "123"; var value = "Name" using(var conn = GetMyConnection()) { var result = conn.QueryFirstOrDefault<string>( @"SELECT [Id] FROM [dbo].[MyTable] WHERE JSON_VALUE([JsonColumn], @MyQuery) = @Str", new { MyQuery = $"$.{value}", Str = str } ); } I try this in SQL Server, it is working: SELECT [Id] FROM [dbo].[MyTable] WHERE JSON_VALUE([JsonColumn], '$.Name') = '123' How should I adjust my code? 回答1: I try this in SQL Server, it

Choosing a binary collation that can differentiate between 'ss' and 'ß' for nvarchar column in Sql Server

和自甴很熟 提交于 2019-12-18 13:16:02
问题 As the default SQL_Latin1_General_CP1_CI_AS collation of SQL server can't differentiate between ss and ß , I want to change the collation of a specific column in a table to SQL_Latin1_General_CP437_BIN2 , as advised in here. However, I am not sure whether this is generally a good practice or not. Also I am not sure about the implications other than the following: Changing the sort order: As I am never sorting the data on this column, it might not be a problem for me. However, if you think

Choosing a binary collation that can differentiate between 'ss' and 'ß' for nvarchar column in Sql Server

我的未来我决定 提交于 2019-12-18 13:15:27
问题 As the default SQL_Latin1_General_CP1_CI_AS collation of SQL server can't differentiate between ss and ß , I want to change the collation of a specific column in a table to SQL_Latin1_General_CP437_BIN2 , as advised in here. However, I am not sure whether this is generally a good practice or not. Also I am not sure about the implications other than the following: Changing the sort order: As I am never sorting the data on this column, it might not be a problem for me. However, if you think

How to search SQL column containing JSON array

谁说胖子不能爱 提交于 2019-12-17 19:39:40
问题 I have a SQL column that has a single JSON array: {"names":["Joe","Fred","Sue"]} Given a search string, how can I use SQL to search for a match in the names array? I am using SQL 2016 and have looked at JSON_QUERY, but don't know how to search for a match on a JSON array. Something like below would be nice. SELECT * FROM table WHERE JSON_QUERY(column, '$.names') = 'Joe' 回答1: For doing a search in a JSON array, one needs to use OPENJSON DECLARE @table TABLE (Col NVARCHAR(MAX)) INSERT INTO

SQL Server 2016 for JSON output integer array

江枫思渺然 提交于 2019-12-17 16:44:16
问题 I'd like to get JSON with an array of integers using SQL Server 2016's For JSON feature. I'm stumped on array of integers. Database table structures: declare @Employees table (ID int, Name nvarchar(50)) insert into @Employees values (1, 'Bob'), (2, 'Randy') declare @Permissions table (ID int, PermissionName nvarchar(50)) insert into @Permissions values (1, 'Post'), (2, 'Comment'), (3, 'Edit'), (4, 'Delete') declare @EmployeePermissions table (EmployeeID int, PermissionID int) insert into

SQL Isnull is not working and returns a value even if it is a space

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-14 03:29:09
问题 I am using SQL Server 2016 and came across an issue with the isnull function. The value in that field is a space but keeps getting selected, below is my code: SELECT * FROM table WHERE isnull (field1,'')<>'' AND field1<>' ' If I copy and paste from field1, it is one space ' '. Thanks 回答1: Your space is not normal space (hex 0x20, decimal 32) select ASCII(LEFT(field1, 1), * From table where isnull (field1,'')<>'' Most likely it is one of Linefeed decimal 10 Carriage return decimal 13 Null

SQL 2016 RC3 R Services Error

孤街浪徒 提交于 2019-12-13 21:22:19
问题 Many of the current questions are with previous versions of the RC or CTP. This is using the latest docs and build for RC3. I am running their sample code to verify everything is working: exec sp_execute_external_script @language =N'R', @script=N'OutputDataSet<-InputDataSet', @input_data_1 =N'select 1 as hello' with result sets (([hello] int not null)); go Here is the error: Msg 39021, Level 16, State 1, Line 1 Unable to launch runtime for 'R' script. Please check the configuration of the 'R'

Full-text search stemming not returning consistent results in different languages

ぐ巨炮叔叔 提交于 2019-12-13 19:57:20
问题 I have an Sql Server 2016 database with full text indexes defined on 4 columns, each configured for a different language: Dutch, English, German & French. I used the wizard to setup the full-text index. I am using CONTAINSTABLE with FORMSOF and for each language I would expect executing a query with either the word stem or any verb form would return both results from the example table. This seems to work in English & German, somewhat in French, and not at all in Dutch. I am using a very basic

How to convert comma separated value into rows in sql server

允我心安 提交于 2019-12-13 10:28:11
问题 How can I convert comma separated value as : Table User Name Unit ABC 2,3 to the following : User Name Unit ABC 2 ABC 3 回答1: You have tagged your question with SQL Server 2016, in SQL Server 2016 there is a new function STRING_SPLIT. In SQL Server 2016 your query should be as simple as: declare @tab table ([user_name] varchar(10),Unit varchar(100)) insert into @tab VALUES ('ABC','1,2') SELECT t.[user_name] , Value as Unit FROM @tab t CROSS APPLY STRING_SPLIT(t.Unit , ',') 回答2: In SQL server