Skip to content
Advertisement

Tag: sql-server-2016

Incorrect syntax near format in BULK INSERT?

I’m trying to figure out why the BULK INSERT command I’m using isn’t recognizing the FORMAT and FIELDQUOTE options used in the command. For some reason, I’m getting the error: Msg 102, Level 15, State 1, Line 6 Incorrect syntax near ‘FORMAT’. Addition: FORMAT shows up in pink text in SSMS, FIELDQUOTE shows in black text, the others show in

Is there a LastIndexOf in SQL Server?

I am trying to parse out a value from a string that involves getting the last index of a string. Currently, I am doing a horrible hack that involves reversing a string: To me this code is nearly unreadable. I just upgraded to SQL Server 2016 and I hoping there is a better way. Is there? Answer If you want

LAG functions and NULLS

How can I tell the LAG function to get the last “not null” value? For example, see my table bellow where I have a few NULL values on column B and C. I’d like to fill the nulls with the last non-null value. I tried to do that by using the LAG function, like so: but that doesn’t quite work

Advertisement