SQL: Copy one table data to another table

USE [Registration]
GO

/****** Object: StoredProcedure [dbo].[COPY_TABLE_GENERAL_INFO] Script Date: 02/22/2012 12:27:17 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[COPY_TABLE_GENERAL_INFO]
AS
BEGIN
--exec COPY_TABLE_GENERAL_INFO
INSERT INTO [Registration].[dbo].[T_Std_General_Information](
[StudentId]
,[StudentsName]
,[StudentPicture]
,[FathersName]
,[MothersName]
,[AdvisorId]
,[Sex]
,[BirthDate]
,[DateOfEnrollment]
,[HomeDistrict]
,[PermanentAddress]
,[Nationality]
,[NationalIdCardNumber]
,[Password]
,[PasswordHints]
,[DepartmentId]
,[RoleId]
,[AccountNo]
)
SELECT [StudentId]
,[StudentsName]
,[StudentPicture]
,[FathersName]
,[MothersName]
,[AdvisorId]
,[Sex]
,[BirthDate]
,[DateOfEnrollment]
,[HomeDistrict]
,[PermanentAddress]
,[Nationality]
,[NationalIdCardNumber]
,[Password]
,[PasswordHints]
,[DepartmentId]
,[RoleId]
,[AccountNo]
FROM [Registration2K11].[dbo].[T_Std_General_Information]

END

GO

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s