|
 |
asp_databases thread: Re: SQL IDENTITY property (urgent)
Message #1 by "Steven Broos" <steven.broos@s...> on Mon, 4 Mar 2002 19:19:23 +0100
|
|
Hi Ken,
thx for the help.
I found the solution:
SET IDENTITY_INSERT <tablename> OFF
I don't know if this is the solution you meant,
but because of your reply i started searching for other
keywords, and found this.
This is one to remember, maybe you'll need it too in the future :)
Greetings,
Steven
-----Original Message-----
From: Ken Schaefer [mailto:ken@a...]
Sent: maandag 4 maart 2002 01:27
To: ASP Databases
Subject: [asp_databases] Re: SQL IDENTITY property (urgent)
Can you use the BULK INSERT T-SQL statement without the CHECK_CONSTAINTS
option, and the KEEPIDENTITY option on? See Books Online for more details.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Steven Broos" <steven.broos@s...>
Subject: [asp_databases] SQL IDENTITY property (urgent)
: I have a very nasty problem.
:
: I use IDENTITY(1, 1) on my primary key fields (int) to have a unique
: identifier.
: I need to make a little application that copies all my tables + content
into
: a textfile,
: and need to restore these contents in a brand new database with CREATE
TABLE
: & INSERT statements.
: Restoring a backup is not possible
:
: Offcourse, the ID-fields have to remain the same, because I use
referential
: integrity.
:
: What I wanted to do:
: I create the tables just as they were, but I don't set the IDENTITY
: property.
: (a IDENTITY field can't be written, but you probably know that :-) )
: I can insert the data, with the same ID-field as in the previous database
: Now I need to set the IDENTITY property on that column.
:
: It's easy in enterprise manager, just click and it's done.
: Only problem is, I can't use enterprise manager, so I have to set IDENTITY
: with a query
:
: Alter table <table> alter column <column> set identity
: Alter table <table> alter column <column> <type> identity
: ...
:
: I tried a lot, and nothing is working.
:
: I searched the net for almost 4 hours, but couldnt find anything :/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$subst('Email.Unsub').
_____________________________________________________________________
// free anonymous email || forums \\ subZINE || anonymous browsing
subDIMENSION -- http://www.subdimension.com
Message #2 by "Ken Schaefer" <ken@a...> on Mon, 4 Mar 2002 11:26:51 +1100
|
|
Can you use the BULK INSERT T-SQL statement without the CHECK_CONSTAINTS
option, and the KEEPIDENTITY option on? See Books Online for more details.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Steven Broos" <steven.broos@s...>
Subject: [asp_databases] SQL IDENTITY property (urgent)
: I have a very nasty problem.
:
: I use IDENTITY(1, 1) on my primary key fields (int) to have a unique
: identifier.
: I need to make a little application that copies all my tables + content
into
: a textfile,
: and need to restore these contents in a brand new database with CREATE
TABLE
: & INSERT statements.
: Restoring a backup is not possible
:
: Offcourse, the ID-fields have to remain the same, because I use
referential
: integrity.
:
: What I wanted to do:
: I create the tables just as they were, but I don't set the IDENTITY
: property.
: (a IDENTITY field can't be written, but you probably know that :-) )
: I can insert the data, with the same ID-field as in the previous database
: Now I need to set the IDENTITY property on that column.
:
: It's easy in enterprise manager, just click and it's done.
: Only problem is, I can't use enterprise manager, so I have to set IDENTITY
: with a query
:
: Alter table <table> alter column <column> set identity
: Alter table <table> alter column <column> <type> identity
: ...
:
: I tried a lot, and nothing is working.
:
: I searched the net for almost 4 hours, but couldnt find anything :/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #3 by "Steven Broos" <steven.broos@s...> on Sun, 3 Mar 2002 22:12:36 +0100
|
|
Hi there,
I have a very nasty problem.
I use IDENTITY(1, 1) on my primary key fields (int) to have a unique
identifier.
I need to make a little application that copies all my tables + content into
a textfile,
and need to restore these contents in a brand new database with CREATE TABLE
& INSERT statements.
Restoring a backup is not possible
Offcourse, the ID-fields have to remain the same, because I use referential
integrity.
What I wanted to do:
I create the tables just as they were, but I don't set the IDENTITY
property.
(a IDENTITY field can't be written, but you probably know that :-) )
I can insert the data, with the same ID-field as in the previous database
Now I need to set the IDENTITY property on that column.
It's easy in enterprise manager, just click and it's done.
Only problem is, I can't use enterprise manager, so I have to set IDENTITY
with a query
Alter table <table> alter column <column> set identity
Alter table <table> alter column <column> <type> identity
...
I tried a lot, and nothing is working.
I searched the net for almost 4 hours, but couldnt find anything :/
Anyone who can help me out here please ? It's kinda urgent...
thanks a lot !
Best regards,
Steven
|
|
 |