﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Article Discussions by Author / Discuss content posted by Arshad Ali  / Corrected SQL script / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sat, 18 May 2013 10:40:07 GMT</lastBuildDate><ttl>20</ttl><item><title>Corrected SQL script</title><link>http://www.sqlservercentral.com/Forums/Topic778460-1463-1.aspx</link><description>Great article! The table creation and data insertion script did not work due to missing declarative statements, here is the complete script:CREATE TABLE Employees_2000_2005 (        EmpID INT PRIMARY KEY NOT NULL IDENTITY,        EmpName VARCHAR(255) NOT NULL,        Title VARCHAR(255) NOT NULL,        ReportsTo INT FOREIGN KEY REFERENCES Employees_2000_2005(EmpID) NULL )GOdeclare @CTO as intdeclare @DevManager as intdeclare @TestManager as intdeclare @DevLead1 as intdeclare @DevLead2 as intdeclare @TESTLead as intINSERT INTO Employees_2000_2005(EmpName, Title, ReportsTo)VALUES ('Akram', 'Chief Technology Officer', NULL)SELECT @CTO = @@IDENTITY  INSERT INTO Employees_2000_2005(EmpName, Title, ReportsTo)VALUES ('Ranjit', 'DEV Manager', @CTO)SELECT @DevManager = @@IDENTITY  INSERT INTO Employees_2000_2005(EmpName, Title, ReportsTo)VALUES ('Adil', 'TEST Manager', @CTO)SELECT @TESTManager = @@IDENTITY  INSERT INTO Employees_2000_2005(EmpName, Title, ReportsTo)VALUES ('Chandan', 'DEV Leader', @DevManager)SELECT @DevLead1 = @@IDENTITY  INSERT INTO Employees_2000_2005(EmpName, Title, ReportsTo)VALUES ('Sudeep', 'DEV Leader', @DevManager)SELECT @DevLead2 = @@IDENTITY  INSERT INTO Employees_2000_2005(EmpName, Title, ReportsTo)VALUES ('Ashraf', 'TEST Leader', @TESTManager)SELECT @TESTLead = @@IDENTITY    INSERT INTO Employees_2000_2005(EmpName, Title, ReportsTo)VALUES ('Dheeraj', 'DEV Engineer', @DevLead1)INSERT INTO Employees_2000_2005(EmpName, Title, ReportsTo)VALUES ('Hem', 'DEV Engineer', @DevLead1)INSERT INTO Employees_2000_2005(EmpName, Title, ReportsTo)VALUES ('Gaurav', 'DEV Engineer', @DevLead1)  INSERT INTO Employees_2000_2005(EmpName, Title, ReportsTo)VALUES ('Uday', 'DEV Engineer', @DevLead2)INSERT INTO Employees_2000_2005(EmpName, Title, ReportsTo)VALUES ('Shayam', 'DEV Engineer', @DevLead2)  INSERT INTO Employees_2000_2005(EmpName, Title, ReportsTo)VALUES ('Mukesh', 'TEST Engineer', @TESTLead)INSERT INTO Employees_2000_2005(EmpName, Title, ReportsTo)VALUES ('Sarfaraz', 'TEST Engineer', @TESTLead)  --After inserting the records as similar to the above tree, we will have  --a table which will have records something like this</description><pubDate>Thu, 27 Aug 2009 10:24:24 GMT</pubDate><dc:creator>Terrence-607905</dc:creator></item></channel></rss>