Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

there is any Way in SQL-Server? Expand / Collapse
Author
Message
Posted Thursday, June 25, 2009 10:31 PM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, December 8, 2014 4:27 AM
Points: 284, Visits: 1,249
My Job role is Client Back-end Support and Back-end Coding..

If there is any problem in client live database...

here i have to write a query it may be set of Tsql query , altering procedure,fn,trigger..etc..

After Finishing my task I have to create a small program in vb,.net etc..
and then converting exe file ,finally send to them .. After they can executes

Reason.. They are don't know to execute that set of tsql in sql server,

I need to Know?
Is there any way in Sql server can we create a executable file for set of tsql Like Batch File....





Many Thanks!
S.saravanan
“I am a slow walker, but I never walk backwards-
Abraham Lincoln”
Post #742363
Posted Thursday, June 25, 2009 11:37 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Tuesday, November 11, 2014 7:21 AM
Points: 83, Visits: 499
Yes, its very much possible using sqlcmd..hopefully you are using SQL 2005 version...

Sample script

sqlcmd -S. -E -Q "select * from sys.objects"
pause

save the above file as .bat and try

Post #742368
Posted Thursday, June 25, 2009 11:54 PM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, December 8, 2014 4:27 AM
Points: 284, Visits: 1,249
In 2005 ,
If i running in query window that gives the below error..

tell me clearly.. like step by step...

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'S'.


Many Thanks!
S.saravanan
“I am a slow walker, but I never walk backwards-
Abraham Lincoln”
Post #742372
Posted Friday, June 26, 2009 12:09 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Tuesday, November 11, 2014 7:21 AM
Points: 83, Visits: 499
Open a notepad file..type in the below command

sqlcmd -s -E -Q<"Your Query">
pause


save the file as .bat file and just double click on the file..it will run the required commond...for testing initially you can specify just a select statement for your query
Post #742381
Posted Friday, June 26, 2009 12:15 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, December 8, 2014 4:27 AM
Points: 284, Visits: 1,249
THANKS WORKING FINE....

Many Thanks!
S.saravanan
“I am a slow walker, but I never walk backwards-
Abraham Lincoln”
Post #742387
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse