Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

concatenation strings within a select statement

Status
Not open for further replies.

junkmail

Programmer
Joined
Jan 7, 2001
Messages
134
Location
US
can someone tell me the correct syntax for replacing the hard coded path and file name with a declared variable? I am assuming I have to build it by concatenation but the apostrophe's are throwing me off.



SELECT * into test FROM OPENROWSET('VFPOLEDB', 'c:\work\'; ' '; ' ', 'SELECT * FROM test.dbf')
 
Double all apostrophes in the string:
Code:
DECLARE @Test varchar(300)
SET @Test = '  c:\Work\;'' '';'' ''    '


Borislav Borissov
VFP9 SP2, SQL Server
 
You will have to execute it dynamically by building the whole string and then executing it execute(@SQL). You need to double every single quote.

PluralSight Learning Library
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top