all groups > sql server new users > september 2006 >
You're in the

sql server new users

group:

Executing an sql script on a remote database from Visual Studio .NET 2005


Executing an sql script on a remote database from Visual Studio .NET 2005 Nathan Sokalski
9/28/2006 5:09:41 PM
sql server new users: I am connecting to a remote SQL Server database from Visual Studio .NET
2005. I have an sql script located on my machine containing the sql code I
want to use to create several tables, and want to execute it. How can I do
this from Visual Studio .NET 2005? I do not like designing the database
using the designer because sometimes the designer uses different words,
phrases things differently, and causes me to be unsure exactly what the
properties of the fields in my database are. If anybody know how to do this,
please let me know. Thanks.
--
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/

Re: Executing an sql script on a remote database from Visual Studio .NET 2005 William (Bill) Vaughn
9/28/2006 6:09:02 PM
An SQL script (by definition) can be executed from anywhere--but it's
limited in what it can do in a single operation. On the other hand, a SQL
batch (which is composed of a set of scripts) can perform a whole series of
operations--but only one script at a time. So, it's not at all unusual to
create or maintain a database using scripts and batches. Generally that's
what DBAs do. However, nowadays SQL Server Management Studio (SSMS) knows
how to generate the tables through a well-understood user interface that
precludes the need for batches and scripts. If, however, you still want to
execute these, you can write your own code to execute the scripts or batches
or simply open SSMS and execute them directly from there--right from the
file containing the properly formatted script or batch.

hth
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
Between now and Nov. 6th 2006 you can sign up for a substantial discount.
Look for the "Early Bird" discount checkbox on the registration form...

[quoted text, click to view]

AddThis Social Bookmark Button