March 15, 2013 at 8:43 am
Question.. the following code:
set @strSQL = 'bulk insert MYServer..[' + @tablename + '] from ''\\mylocation\subfolder\' + @tableName + '.dat'' with (fieldterminator = ''|'');'
exec sp_executesql @strSQL
print @tableName
will run for a while and then spit out 20 or 30 table names...then run for a while and then spit out 20 or 30 more names....
...as it runs through my list of files to import.
Can someone tell me why it's not operating in a sequential order? ie, 1. bulk insert statement created, 2. run bulk insert statement, 3. PRINT THE DAMN TABLE NAME before going back to step one.
Is this a dynamic sql issue or a bulk insert issue or a completely unrelated issue?
March 15, 2013 at 8:54 am
PRINT is buffered, you can use instead:
RAISERROR ('Message', 1, 1) WITH NOWAIT
March 15, 2013 at 9:05 am
Ah.. that makes sense. Thank you very much.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy