Quantcast
Channel: SQLServerCentral » SQL Server 2012 » SQL Server 2012 - T-SQL » Latest topics
Viewing all articles
Browse latest Browse all 4901

Bulk insert in procedure. Use of quotes for variables

$
0
0
Hi everybody,I struggled with a bulk insert in procedure and i eventually found a working piece of code. Except that i did'nt understand the general rules to wrap variables.Exemple : N'BULK INSERT ' + QUOTENAME(@nomtable) + N'FROM ''' + @chemin + @filename + N''' WITH (FIELDTERMINATOR = '';'', ROWTERMINATOR = '''', FIRE_TRIGGERS)'This is working, but why are we using ''' ??Now something that's not working..SET @effacer = 'master.dbo.xp_cmdshell ''DEL '+ @chemin + @filenameEXECUTE (@effacer)Something wrong with quotes i guess....I'd like to understand the rule for this!

Viewing all articles
Browse latest Browse all 4901

Trending Articles