Click here to Skip to main content
15,915,019 members
Home / Discussions / Database
   

Database

 
GeneralSQL SERVER HELP Pin
| Muhammad Waqas Butt |20-Dec-04 11:12
professional| Muhammad Waqas Butt |20-Dec-04 11:12 
GeneralRe: SQL SERVER HELP Pin
Colin Angus Mackay20-Dec-04 11:30
Colin Angus Mackay20-Dec-04 11:30 
GeneralRestore a database Pin
bigtone7820-Dec-04 9:32
bigtone7820-Dec-04 9:32 
GeneralRe: Restore a database Pin
Dallas Matthews20-Dec-04 10:01
Dallas Matthews20-Dec-04 10:01 
GeneralRe: Restore a database Pin
bigtone7820-Dec-04 10:09
bigtone7820-Dec-04 10:09 
GeneralRe: Restore a database Pin
Rob Graham24-Dec-04 6:00
Rob Graham24-Dec-04 6:00 
Generalsql transaction Pin
sianatia20-Dec-04 8:20
sianatia20-Dec-04 8:20 
GeneralRe: sql transaction Pin
Colin Angus Mackay20-Dec-04 8:35
Colin Angus Mackay20-Dec-04 8:35 
The "GO" is a delimiter for the Query Analyser only. You can change it to what ever you want by going to Tools-->Options... and selecting the Connection tab. There is an item called Batch Separator that you can set.

The example you gave does not put both DELETE commands in one transaction

You do not have to separate all commands into individual batches. So you can send two commands in one batch, like this
DELETE FROM mytable; DELETE FROM mytable2;


Of course, if you need to call multiple commands then the the better solution is to use stored procedures and call the stored procedure. In the query analyser:
CREATE PROCEDURE DeleteStuff
AS
    BEGIN TRANSACTION
        DELETE FROM mytable
        DELETE FROM mytable2
    COMMIT TRANSACTION
GO


Then in your .NET application:
SqlCommand cmd = new SqlCommand("DeleteStuff", myConnection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.ExecuteNonQuery();


Does this help?


Do you want to know more?
WDevs.com - Member's Software Directories, Blogs, FTP, Mail and Forums


GeneralSingle connection in several forms Pin
hammerj18-Dec-04 23:58
susshammerj18-Dec-04 23:58 
GeneralRe: Single connection in several forms Pin
Colin Angus Mackay19-Dec-04 2:13
Colin Angus Mackay19-Dec-04 2:13 
GeneralRe: Single connection in several forms Pin
j1hammer19-Dec-04 2:34
j1hammer19-Dec-04 2:34 
GeneralRe: Single connection in several forms Pin
Colin Angus Mackay19-Dec-04 2:38
Colin Angus Mackay19-Dec-04 2:38 
GeneralRe: Single connection in several forms Pin
j1hammer19-Dec-04 23:34
j1hammer19-Dec-04 23:34 
GeneralLogin Failed : user ASPNET (MSDE) Pin
asif m@hmood18-Dec-04 7:28
asif m@hmood18-Dec-04 7:28 
GeneralRe: Login Failed : user ASPNET (MSDE) Pin
Mike Dimmick18-Dec-04 8:38
Mike Dimmick18-Dec-04 8:38 
GeneralLibraries Pin
abo el ror18-Dec-04 3:32
abo el ror18-Dec-04 3:32 
GeneralMSDE US Date format problem Pin
hugonz17-Dec-04 23:40
hugonz17-Dec-04 23:40 
GeneralRe: MSDE US Date format problem Pin
Mike Dimmick18-Dec-04 9:04
Mike Dimmick18-Dec-04 9:04 
GeneralRe: MSDE US Date format problem Pin
hugonz18-Dec-04 11:19
hugonz18-Dec-04 11:19 
GeneralRe: MSDE US Date format problem Pin
Jon Hulatt19-Dec-04 22:51
Jon Hulatt19-Dec-04 22:51 
GeneralRe: MSDE US Date format problem Pin
hugonz21-Dec-04 18:36
hugonz21-Dec-04 18:36 
GeneralInstalling Database Pin
abo el ror17-Dec-04 14:29
abo el ror17-Dec-04 14:29 
GeneralRe: Installing Database Pin
Colin Angus Mackay17-Dec-04 15:28
Colin Angus Mackay17-Dec-04 15:28 
GeneralRe: Installing Database Pin
Javier Lozano17-Dec-04 17:58
Javier Lozano17-Dec-04 17:58 
GeneralMore on CRecordset Instances Pin
Chris Meech17-Dec-04 8:22
Chris Meech17-Dec-04 8:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.