Author |
Topic |
dev2dev
Starting Member
48 Posts |
Posted - 2007-12-27 : 03:20:14
|
...and it is because...when i drag and drop my script file into query window unlike query analyzer which selects the current database, new MSSMS selects the users 'default' database.we maintain 1 script file for each sp/function and ddl/views groupe related stuff in 1 or more filesin query analyzer I just have to select DB where i want to deploy scripts and drag and drop the files from explorer and then then 1) press F5 (to run) 2) press CTL + F4 (to close window)3) repeat till all scripts are deployedand now in MSSMS1) select db (this step is really painful especially when i have to deploy more than 1 script/file)2) press F53) press CTL + F44) repeatis there any settings that could change the behavior of SMS2K5 like old QA2K?well what i cant do here is change default db to the tartget db before deploying and switch back after deploying (but not a true solution)thanks in advance |
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2007-12-27 : 04:24:24
|
how about saving your scripts as a project so you only set the db connection once?Em |
 |
|
dev2dev
Starting Member
48 Posts |
Posted - 2007-12-27 : 07:13:21
|
hmmmm, not sure what to do after creating a projectmy existing scripts are in hierarchy folder structurewhen i added them to project all of them are showing in one single branchnow I don't know how to run all of them in a specific sequence one after one |
 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-12-27 : 09:47:44
|
every script should have a Use DbName on top of it anyway._______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com <- new version out |
 |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2007-12-27 : 10:40:45
|
Concatenate the scripts into a single script?==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2007-12-27 : 13:32:18
|
quote: Originally posted by dev2devI hate new management studio for 1 reason...
You simply have not used it long enough. Soon, you will uncover many more reasons to hate it.e4 d5 xd5 Nf6 |
 |
|
eyechart
Master Smack Fu Yak Hacker
3575 Posts |
Posted - 2007-12-27 : 14:56:26
|
i hate SSMS because I can no longer multi-select objects and script them out.-ec |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-12-27 : 15:04:58
|
quote: Originally posted by spirit1 every script should have a Use DbName on top of it anyway.
I disagree. If you have deployment scripts like we do, then USE dbName at the top of each script would cause unwanted effects. We pass the name of the database to osql/sqlcmd as the database can change between environments. Anything that can change should not be included in the scripts.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2007-12-27 : 15:18:43
|
quote: Originally posted by eyechart i hate SSMS because I can no longer multi-select objects and script them out.-ec
This will do the same thing as enterprise manager Just put it in a .vbs file and run it then pick the objects you want.This is for tables but easy to change.To concatenate to a single script from dos (or a .bat file)type *.TAB > mydb.sqldim svr dim db Dim tbl set svr = createobject("SQLDMO.SQLServer") svr.loginsecure = true svr.Connect "myserver\myinstance" Set db = svr.Databases("mydatabase") For Each tbl In db.Tables if tbl.SystemObject = 0 then tbl.script 69, "Tables\" & tbl.Name & ".TAB" end if Next svr.disconnect set svr = nothing the script format may change betweem v2000 and 2005.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
dev2dev
Starting Member
48 Posts |
Posted - 2007-12-28 : 00:33:23
|
quote: every script should have a Use DbName on top of it anyway.
This works only for three dbs out of 5 dbs we havetwo dbs keeps changingquote: Concatenate the scripts into a single script?
that we are doing some times just before full deployment only but we cannot, but we cannot maintain them in 1 single script file permanetly, so merging process in extra burden on usquote: USE dbName at the top of each script would cause unwanted effects. We pass the name of the database to osql/sqlcmd as the database can change between environments
i tried this some time back, but i have to create a batch file for this and maintain this as well when ever i add/remove scripts, so extra burden. more importantly, the main reason why i avoided it because we might over see errors that could occur. but using the -o option might help us tracing the errors after deploymetany way those all are workarounds, so there is no way we can set the option for old behavior :(quote: You simply have not used it long enough. Soon, you will uncover many more reasons to hate it.
lolthanks for all discussion |
 |
|
|