-- Posts and Comments ------------------------------- alter table be_posts add cspostID int null insert into be_posts (PostID, Title, PostContent, DateCreated, DateModified, Author, IsPublished, cspostID) select NEWID(), subject, body, postdate, postdate, 'daveburke', 1, postID from dbvtcs2007.dbo.cs_posts where sectionID = 5 and postlevel = 1 insert into be_postcomment (postID, CommentDate, author, email, website, comment, isapproved) select b.postid, c.postdate, (dbvtcs2007.dbo.FetchExtendendAttributeValue('SubmittedUserName', c.PropertyNames, c.PropertyValues)), 'na@dbvt.com', (dbvtcs2007.dbo.FetchExtendendAttributeValue('TitleUrl', c.PropertyNames, c.PropertyValues)) , c.body, 1 from be_posts b inner join dbvtcs2007.dbo.cs_posts c on b.cspostID = c.parentID where c.sectionid = 5 and c.postlevel = 2 and c.posttype = 1 and c.applicationposttype <> 8 update be_postcomment set author = 'Dave Burke' where author is null -- Categories -------------------------------------------- alter table be_categories add cscategoryID int null insert into be_categories (categoryname, cscategoryID) select [name], categoryID from dbvtcs2007.dbo.cs_post_categories c where c.isenabled = 1 and sectionID = 5 update be_categories set cscategoryID = c.categoryID from dbvtcs2007.dbo.cs_post_categories c, be_categories b where b.categoryname = c.name insert into be_postcategory (postid, categoryid) select b.postid, bc.categoryID from be_categories bc inner join dbvtcs2007.dbo.cs_post_categories c on c.categoryID = bc.cscategoryID inner join dbvtcs2007.dbo.cs_posts_incategories cic on c.categoryID = cic.categoryID inner join dbvtcs2007.dbo.cs_posts p on cic.postid = p.postid inner join be_posts b on b.cspostID = p.postID