MS SQL 2005 Temporary Tables

DECLARE @ArticlesTable TABLE(ArticleId INT)


Fill it up:

INSERT INTO @ArticlesTable

 SELECT dbo.cmsArticle.ArticleId

FROM   dbo.cmsArticle

WHERE dbo.cmsArticle.CreatedDate<'01/01/2008'


Use it:

DELETE FROM dbo.cmsArticle WHERE ArticleId IN (SELECT * FROM @ArticlesTable)


Tuesday, March 11, 2008 | Comments (1) | Add Comment

Comments

Gravatar

Re:MS SQL 2005 Temporary Tables

Isn't this example for a table variable ?

8/8/2008 11:25:29 AM | by avatare

New Comment

Your Name:
Email (for internal use only):
Subject:
Comment:
 
Code above:

Categories

Recent Tweets

Valid XHTML 1.0 Transitional