5.9.10

Auto data population using GO statement

Dear Readers, have you tried the below statement????????

INSERT INTO t1 DEFAULT VALUES;
GO 5 --- What this guy will do?????


What's the use of GO statement????? It's just a seperator between statements. It makes the statements as seperate batches.

Any wild guesses...........???????????????????

Ok let's see a small example,

DROP TABLE t1
go
CREATE TABLE t1 (
c1 INT IDENTITY,
c2 as c1*2
);
GO
-- I have create a table
SET NOCOUNT ON;
GO
INSERT INTO t1 DEFAULT VALUES;
GO 5
select * from t1


OK, go ahead and start populating your dummy tables.

Cheers,
Venkatesan Prabu .J

No comments:

Post a Comment