Quote II | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Quote II

Hi, i wrote before (in last message )bad sample , because i tried to compile it in other source. But there is mistake , i don’ understand using the quote in programming of sources
DECLARE @tmp_path as varchar(255), @tmp_table as varchar(255),@tmp_file as varchar(255) set @tmp_path= ‘d:Upload’
set @tmp_table and = …. i create table during run of procedure
set @tmp_file = @tmp_table+’.txt’ … name of file changes during run of procedure and i want import from this one execute (‘BULK INSERT ‘ + @tmp_table +’ from ‘+’@[email protected]_file’) there is bad with using of quote Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near ‘@tmp_path’.
I wanted to ask you about it before. Thaks, Lubo

that should be
execute (‘BULK INSERT ‘ + @tmp_table +’ from ”’[email protected][email protected]_file+””) Madhivanan Failing to plan is Planning to fail
You might also want to have a look at QUOTENAME in BOL. —
Frank Kalis
Microsoft SQL Server MVP
Ich unterstütze PASS Deutschland e.V. http://www.sqlpass.de)