Data Import SQL DB table To SQL DB table
m going to export some database table data to another database.(Original database in another language).I created new database like this.(Original Database 2 tables--> Convert to English --> Merge --> New 1 table )
This is New 1 Table(New Users Table)
CREATE TABLE [dbo].[Users](
[uid] [int] IDENTITY(1,1) NOT NULL,
[username] [varchar](50) NULL,
[password] [varchar](50) NULL,
[state] [int] NULL,
[name] [varchar](50) NULL,
[license] [varchar](50) NULL,
[lansno] [varchar](50) NULL,
[curcuit_no] [varchar](50) NULL,
[communism] [varchar](100) NULL,
[Olduid] [int] NULL,
[Is_hunter] [bit] NULL,
[free_text] [text] NULL,
[country] [varchar](50) NULL,
[curcuit] [varchar](50) NULL,
[license_territory] [varchar](50) NULL,
[forest] [varchar](50) NULL,
[association] [varchar](50) NULL,
[hunt_ar] [varchar](50) NULL,
[area] [varchar](50) NULL,
[contract] [varchar](50) NULL,
[radio_frequency] [varchar](50) NULL,
CONSTRAINT [PK_timeuser] PRIMARY KEY CLUSTERED
(
[uid] ASC
)
Above table takes it from merge Users + Hunter tables
CREATE TABLE [dbo].[Hunters](
[id] [int] IDENTITY(1,1) NOT NULL,
[iicence] [varchar](50) NULL,
[hunter] [varchar](50) NULL,
[free_text] [text] NULL,
[country] [varchar](50) NULL,
[circuit] [varchar](50) NULL,
[licence_territory] [varchar](50) NULL,
[forest] [varchar](50) NULL,
[association] [varchar](50) NULL,
[hunt_ar] [varchar](50) NULL,
[area] [varchar](50) NULL,
[contract] [varchar](50) NULL,
[radio_frequency] [varchar](50) NULL,
[town] [varchar](100) NULL,
CONSTRAINT [PK_tbl_hunters] PRIMARY KEY CLUSTERED
(
[id] ASC
)
<sup class="bbc" style="margin-margin-right:0px;margin-bottom:0px;margin-padding-padding-right:0px;padding-bottom:0px;padding-">This is
the Old Users Table</sup>
<sup class="bbc" style="margin-margin-right:0px;margin-bottom:0px;margin-padding-padding-right:0px;padding-bottom:0px;padding-"></sup>
CREATE TABLE [dbo].[Users](
[uid] [int] IDENTITY(1,1) NOT NULL,
[username] [varchar](50) NULL,
[password] [varchar](50) NULL,
[state] [int] NULL,
[name] [varchar](50) NULL,
[license] [varchar](50) NULL,
[lansno] [varchar](50) NULL,
[curcuit_no] [varchar](50) NULL,
[communism] [varchar](100) NULL,
I want this... New users tables uid is Auto increment & both old users table & hunters table has id's that id's needs to go to the Olduid coloumn. &&
Hunters table dowsn't have a Username & Password.. Need to pass Empty String for that.(All Old id's need to go to the Olduid coloumns & uid is auto increment..
So help me to do this... I'm newbie.. soo... how do i write a script for that ?
thanks<sup class="bbc" style="margin-margin-right:0px;margin-bottom:0px;margin-padding-padding-right:0px;padding-bottom:0px;padding-"></sup>
May 27th, 2012 6:57am