[dba-VB] SCRUM: Applying .sql

Salakhetdinov Shamil mcp2004 at mail.ru
Sun Apr 5 09:55:40 CDT 2009


Hi Mike,

OK, it worked for you but I still think there is a shorter way.

I do use MS SQL Server 2005 Management Studio - it may happen MS SQL Server 2005 Express doesn't have the toolbar/combo - try 

View->Tollbars->SQL Editor

 - the latter toolbar should have a combo with the list of databases.

Another way is to Right-Click on database in the treeview of databases and then select New Query... entry , get new empty query window opened and paste SQL script into it. It will run in context of the db you right-clicked on.

To execute you can use F5.

BTW, you can select any part of query in the query window and execute it (F5) - and only selected part will be executed - nice and useful "trick", which isn't described in the docs? (I have got it quite some time ago from one SQL master)...


--
Shamil

-----Original Message-----
From: "Mike Mattys" <mmattys at rochester.rr.com>
To: "Salakhetdinov Shamil" <mcp2004 at mail.ru>,"Discussion concerning Visual Basic and related programming issues." <dba-vb at databaseadvisors.com>
Date: Sun, 5 Apr 2009 10:33:08 -0400
Subject: Re: [dba-VB] SCRUM: Applying .sql

> Hi Shamil,
> 
> Since there is no combo in the left-hand corner, that cannot be the answer.
> What I did is
> 
> - View ... Toolbars ... Query Designer
> - Open File (*.sql)
> - Copy the content of the .sql files
> 
> - expand Programmability
> - right-click on Stored Procedures
> - select New Stored Procedure
> 
> - Paste in sql file content
> - right-click and Execute
> 
> Receive message:
> Command(s) completed successfully.
> 
> Refreshing the Views category now shows the new View.
> 
> Michael R Mattys
> MapPoint and Database Dev
> www.mattysconsulting.com
> -
> ----- Original Message ----- 
> From: "Salakhetdinov Shamil" <mcp2004 at mail.ru>
> To: "dba-VB" <dba-vb at databaseadvisors.com>
> Sent: Sunday, April 05, 2009 4:06 AM
> Subject: Re: [dba-VB] SCRUM: Applying .sql
> 
> 
> >
> > Hi Mike,
> >
> > You probably didn't set current db to NorthwindNet: in the left top corner 
> > of SQL Management Studion Express there a combo to select current db.
> >
> > Or you can put
> >
> > use NorthwindNet
> > go
> >
> > before the SQL Script's text.
> >
> > Putting such use directive in front of all the scripts isn't practical as 
> > the name of the database can be changed...
> >
> > --
> > Shamil
> >
> >
> > -----Original Message-----
> > From: "Mike Mattys" <mmattys at rochester.rr.com>
> > To: "Salakhetdinov Shamil" <mcp2004 at mail.ru>,"Discussion concerning Visual 
> > Basic and related programming issues." <dba-vb at databaseadvisors.com>
> > Date: Sat, 4 Apr 2009 22:44:20 -0400
> > Subject: Re: [dba-VB] SCRUM: Applying .sql
> >
> >> Hi Team,
> >>
> >> I've just figured out that I can use SQL Management Studio 2005 Express 
> >> to
> >> connect with my SQL2005 db engine and that the Query Editor is actually
> >> an upgrade to the 2000 Query Analyzer.
> >>
> >> So I opened the file 0001_vw_CustomerOrdersProducts.sql and tried to
> >> execute.
> >> I received the following error:
> >> "Msg 208, Level 16, State 1, Procedure vw_CustomerOrdersProducts, Line 3
> >> Invalid object name 'dbo.Customer'."
> >> Why?
> >>
> >> -
> >> Michael R Mattys
> >> MapPoint and Database Dev
> >> www.mattysconsulting.com
> >> -
> >> ----- Original Message ----- 
> >> From: "Salakhetdinov Shamil" <mcp2004 at mail.ru>
> >> To: "Discussion concerning Visual Basic and related programming issues."
> >> <dba-vb at databaseadvisors.com>
> >> Sent: Saturday, April 04, 2009 7:09 PM
> >> Subject: Re: [dba-VB] SCRUM: Sprint - 2nd week plan
> >>
> >>
> >> >
> >> > Hi SCRUM Team,
> >> >
> >> > I have made the following reports:
> >> >
> >> > - Alphabetical List of Products
> >> > - Product By Category
> >> >
> >> > but the second one is not yet finished - looking for a way to make it
> >> > multi-column. Any proposals?
> >> >
> >> > Current solution is uploaded to the server.
> >> > Please always look at \!Documents\Notes.txt file after you update your
> >> > code from server to find are there any new SQL scripts to apply - here 
> >> > is
> >> > the current list:
> >> >
> >> > 0001_vw_CustomerOrdersProducts.sql
> >> > 0002_vw_CustomerOrderTotals.sql
> >> > 0003_vw_CustomerCountries.sql
> >> > 0004_vw_AlphabeticalListOfProductsReport.sql
> >> >
> >> > Please add your SQL scripts' file names to this list if you'll create
> >> > some.
> >> >
> >> > Please put all the scripts into \Datasets\SQL subfolder named using
> >> > numeric prefix to have the scripts sorted inthe sequence they were
> >> > created.
> >> >
> >> > Please note how I made SimpleReportsDataSet to keep 'Alphabetical List 
> >> > of
> >> > Products' and 'Product by Category' reports' sources. I used the same
> >> > vw_AlphabeicalListOfProductsReport view for both reports but I have
> >> > renamed table objects in dataset to allow in the future to substitute 
> >> > the
> >> > database object e.g with stored procedure etc. without the need to 
> >> > rename
> >> > anything in the code/forms/reports, which are using this dataset.
> >> >
> >> > Thank you.
> >> >
> >> > --
> >> > Shamil
> >>
> >
> > _______________________________________________
> > dba-VB mailing list
> > dba-VB at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/dba-vb
> > http://www.databaseadvisors.com
> > 
> 




More information about the dba-VB mailing list