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)


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

Comments

Gravatar

Re:MS SQL 2005 Temporary Tables

Isn't this example for a table variable ?

Posted on 8/8/2008 11:25:29 AM by avatare #

New Comment

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

Categories

Recent Tweets

Valid HTML5