zan
zan

Reputation: 355

executing sql server query from a file

I am going to use the FTP task tool to pull a file into the SQL server from a remote host. Is stored procedure the best way to execute a query contained within the file without doing it manually?

Upvotes: 0

Views: 44

Answers (1)

Rahul Tripathi
Rahul Tripathi

Reputation: 172378

You may try like this:

EXEC xp_cmdshell  'sqlcmd -S ' + @DBServerName + ' -d  ' + @DBName + ' -i ' + @FilePathName

Upvotes: 1

Related Questions