Re: How can I force a pause in program execution?
From: Dan Guzman (danguzman_at_nospam-earthlink.net)
Date: 03/26/04
- Next message: John Saunders: "Re: suppress message box display"
- Previous message: Ilya Margolin: "Re: Is this a feature?"
- In reply to: Ken Sturgeon: "How can I force a pause in program execution?"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 26 Mar 2004 11:13:20 -0600
> I'm attempting to build a table and then immediately insert into
> said table. The problem is that the table creation isn't complete before
the
> insert command fires.
You can create a table and immediately insert data like the example below.
'GO' is not a T-SQL statement. It is a batch delimiter recognized by SQL
tools like Query Analyzer. These utilities send the batch of SQL statements
preceding the 'GO' and SQL Server processes the statements in the batch
synchronously so there's no need to explicitly wait for the preceding
statement to finish. The scope of declared variables is local to the
batch.
DECLARE @MyData int
SET @MyData = 1
CREATE TABLE MyTable
(
MyColumn int
)
INSERT INTO MyTable VALUES(@MyData)
GO
-- Hope this helps. Dan Guzman SQL Server MVP "Ken Sturgeon" <ksturgeon@genelco.com> wrote in message news:uywPg%230EEHA.3576@tk2msftngp13.phx.gbl... > In VB one can invoke the DoEvents command to force a pause in program > execution until the last statement execution has completed. I've found no > similar concept in TransactSQL other than using the GO statement. The > problem is that when I invoke the GO command I loose all of my parameter and > variable values. > > Is there an alternative way in which I can force a pause without loosing the > values? I'm attempting to build a table and then immediately insert into > said table. The problem is that the table creation isn't complete before the > insert command fires. > > I thank you in advance for your assistance. > > Ken Sturgeon > >
- Next message: John Saunders: "Re: suppress message box display"
- Previous message: Ilya Margolin: "Re: Is this a feature?"
- In reply to: Ken Sturgeon: "How can I force a pause in program execution?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|