April 11, 2014 at 3:39 am
Hi,
I have a create table script as .txt file. How can i create table using that script through sql query. Plz any one suggest some approach. I heard through openrow set it can be achieved. But how to do.
Thanks
April 11, 2014 at 4:08 am
April 11, 2014 at 4:26 am
Why try to open it through a SQL query? Why not just use a command line utility like PowerShell or sqlcmd.exe? Either of those can read the file and execute it against a database. That's much more efficient than trying to open files through T-SQL.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
April 11, 2014 at 4:33 am
ahhh :crazy:... Indeed... Silly me ... Please try doing the way Grant has proposed...
April 11, 2014 at 4:46 am
Thanks for your reply is there any way to achieve this using open row set
April 11, 2014 at 4:58 am
I'm not sure. It's not something I would try to do. What's the purpose of this approach?
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
April 11, 2014 at 5:36 am
I guess vinodhkumargv is looking for simple solution and could be...
Copy .txt code and past it to the new query windows and execute it. It will create the table.
HTH
---------------------------------------------------
"Thare are only 10 types of people in the world:
Those who understand binary, and those who don't."
April 11, 2014 at 6:42 am
:-D:-):Wow:
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply