|
Hi, I wonder if anyone can help. I am creating dynamic SQL using variables so that I can use the same script for various imports. The script is: When you copy the printed script which looks like this: It works fine, but when you to try to execute it within the script is has the error message:
I am now completely stumped. Any ideas greatfully received. Many thanks
(comments are locked)
|
|
Shouldn't that be You need parentheses around the string otherwise it thinks it's executing a stored proc, or some other module of the type database.schema.object, hence the error saying it can't find the database 'BULK INSERT PriceImportHoldingEW FROM 'C:Auto ImportAuto ImportEandWTest' - i.e. everything up to the first '.' Now I feel really stupid, I thought I'd tried that early on. Yes of course it's working fine now. Doh!!
May 18 '11 at 05:05 AM
Mrs_Fatherjack
Nah don't feel stupid - this catches me out soooooo many times - it's made worse by the fact that when you select out the contents of the string it looks perfect!
May 18 '11 at 05:16 AM
Kev Riley ♦♦
The number of times I get caught out by that one too... It doesn't help that the syntax of the EXECUTE statement does allow for use without parentheses under certain circumstances. The gist of it seems to be if it's a real SP call (eg
May 19 '11 at 06:03 AM
ThomasRushton ♦
(comments are locked)
|

