July 12, 2017 at 6:16 am
Hello all,
i would like to know if it's possible to generate a script (create schema and datas) with the command line ?
because every time i try to generate a script by these step i receive an error :
- right click on db
- select task
- generate script
- next
- i select 'select specific database objects'
- click next
- click advanced => select schema and data in row types of data to script
- file name => path/script.sql
every time i receive and error but without any description ...
thanks for your time
July 12, 2017 at 6:26 am
I've seen issues like this in the GUI scripting; when you use an older version of SQL Server Management Studio(lets say 2008 or 2012) and are connecting to a higher version of SQL(say 2012/14/16)
the issue is the version of Server Management Objects being used;
what specific version of SQL Server Management Studio are you using? what SLQ engine are you connecting to?
grabbing the latest version for SSMS(17.15 i think, or higher) should help. it;s downwards compatible.
Lowell
July 12, 2017 at 7:13 am
Just a suggestion, don't use the GUI. Microsoft has a new command line utility that does a pretty good job.
"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
July 12, 2017 at 8:10 am
Grant Fritchey - Wednesday, July 12, 2017 7:13 AMJust a suggestion, don't use the GUI. Microsoft has a new command line utility that does a pretty good job.
The need to generate scripts isn't an uncommon one. Since MS does it fairly well through the GUI, you would think they'd make it easy to do via a stored procedure and/or the CLI. It's currently pretty easy to do with coded objects but there's nothing so simple for tables (as an example, but you knew that). We shouldn't have to load a bunch of 3rd party stuff to do what should be built in.
--Jeff Moden
Change is inevitable... Change for the better is not.
July 12, 2017 at 8:52 am
Jeff Moden - Wednesday, July 12, 2017 8:10 AMGrant Fritchey - Wednesday, July 12, 2017 7:13 AMJust a suggestion, don't use the GUI. Microsoft has a new command line utility that does a pretty good job.The need to generate scripts isn't an uncommon one. Since MS does it fairly well through the GUI, you would think they'd make it easy to do via a stored procedure and/or the CLI. It's currently pretty easy to do with coded objects but there's nothing so simple for tables (as an example, but you knew that). We shouldn't have to load a bunch of 3rd party stuff to do what should be built in.
Agreed. That's why when I really need it I use PowerShell and an ADO command to do it. Works great. No extra installs needed.
Well, or I use a Redgate tool. 😛
"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
July 12, 2017 at 9:05 am
Grant Fritchey - Wednesday, July 12, 2017 8:52 AMJeff Moden - Wednesday, July 12, 2017 8:10 AMGrant Fritchey - Wednesday, July 12, 2017 7:13 AMJust a suggestion, don't use the GUI. Microsoft has a new command line utility that does a pretty good job.The need to generate scripts isn't an uncommon one. Since MS does it fairly well through the GUI, you would think they'd make it easy to do via a stored procedure and/or the CLI. It's currently pretty easy to do with coded objects but there's nothing so simple for tables (as an example, but you knew that). We shouldn't have to load a bunch of 3rd party stuff to do what should be built in.
Agreed. That's why when I really need it I use PowerShell and an ADO command to do it. Works great. No extra installs needed.
Well, or I use a Redgate tool. 😛
Oooooohhh... Any chance of you posting the Powershell that you have for that?
--Jeff Moden
Change is inevitable... Change for the better is not.
July 12, 2017 at 9:57 am
Jeff Moden - Wednesday, July 12, 2017 9:05 AMOooooohhh... Any chance of you posting the Powershell that you have for that?
In a small panic because I can't find my script, however, here's a very good example. It's not hard.
Also, I said ADO and I meant SMO. My new brain is on back-order I think.
"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
July 12, 2017 at 11:05 pm
Grant Fritchey - Wednesday, July 12, 2017 9:57 AMJeff Moden - Wednesday, July 12, 2017 9:05 AMOooooohhh... Any chance of you posting the Powershell that you have for that?
In a small panic because I can't find my script, however, here's a very good example. It's not hard.
Also, I said ADO and I meant SMO. My new brain is on back-order I think.
Thanks, Grant. I'll give it a shot.
--Jeff Moden
Change is inevitable... Change for the better is not.
July 17, 2017 at 8:50 am
Hello all,
thanks for your time and your knowledge that's really great to share it ...
sorry for the delay ...little problem at the moment 🙂
@lowell => we use actually sql server management in version 11.0.300.0 and the sql server version is 2012
i'm not sure if i can update the sql server management because this machine is a production server .. but i will ask it
@grand fritchey => thanks for the link i will try it
thanks
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply