Wednesday, May 02, 2007

Batching with SQL Server 2005

ok, this is a really cool feature of SQL 2005 that I used the other day to quickly populate some test data....

SQL 2005 has a new "Batching" feature of the syntax that let's you repeat a statement any number of times you'd like by simply adding an integer to the end of the statement.

you can insert 100 test records into a table by issuing this command.

--Issue this command first.
CREATE TABLE dbo.TestTable (ID INT IDENTITY (1,1), RowGUID uniqueidentifier, InsertTime datetime)

--Now issue this command to insert the 100 records.
INSERT INTO dbo.TestTable (RowGUID, InsertTime) VALUES (NEWID(), GETDATE())
GO 100

isn't that cool?

If you execute both together it will try to do the CREATE TABLE 100 times and it will fail but you can see the power of running multiple lines together though...

Thursday, April 12, 2007

Building SaaS Software with SQL Server...

I have been working as a Database Architect for a SaaS software company for almost 2 years now and it's been an exciting challenge building software that is "alway's on". The technology stack that we've used in our e-commerce product line is mostly Microsoft stuff with a new sprinkling of opensource. (Linux and PostgreSQL) I have to admit, interoperabiliy of the Microsoft world and the linux world has come a long way. We have applications that can span both technologies and that is pretty cool. More to come on that topic...