sql - How to compare varchar parameter to null in a natively compiled stored procedure? -


i migrating tables , stored procedures in-memory optimized tables , natively compiled stored procedures , getting stuck on null comparison.

here code:

create table [dbo].[myinmemtable] (     [myid] int not null identity(1,1),     [mydata] varchar(900) collate latin1_general_100_bin2 not null     constraint [pk_myinmemtable] primary key nonclustered ([myid]) ) (memory_optimized = on, durability=schema_only) go  create procedure [dbo].[sp_insertintomyinmemtable](@mydata varchar(900))     native_compilation, schemabinding, execute owner  begin atomic (transaction isolation level = snapshot, language = n'english')     if @mydata not null       begin         insert dbo.[myinmemtable] (mydata) values (@mydata)         select scope_identity()     end     else         select 0 end 

i following error:

msg 12327, level 16, state 101, procedure sp_insertintomyinmemtable, line 306 comparison, sorting, , manipulation of character strings not use *_bin2 collation not supported natively compiled stored procedures. 

how specify collation on parameter, or there alternative way null comparison work?

please see comments @eric j, above.

you can add " collate {collation value} " pretty anywhere can specify field collation seems. did try " if @mydata collate {collation} not null"?

i put answer people finding it.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -