Wednesday, March 28, 2012
Import index and constain
I export the database table,SP,view,use..etc to script
file. After i run the script to another server to rebuild
the database. Only the table(index and constain) can't
import to new database but i have choice the option(index
and constain) when i export the database to script. What
is ths problem?
Many Thanks
JohnJohn
How did you export your objects?
Try using DTS , there is an optino "Transfer Objects" so you will find that
you can export indexes and keys.
"John" <anonymous@.discussions.microsoft.com> wrote in message
news:066301c3c476$0eb20a80$a501280a@.phx.gbl...
> Dear
> I export the database table,SP,view,use..etc to script
> file. After i run the script to another server to rebuild
> the database. Only the table(index and constain) can't
> import to new database but i have choice the option(index
> and constain) when i export the database to script. What
> is ths problem?
> Many Thanks
> John
Import in table identity column
Data file doesn't has the data for the column.
I created view which has the column except the identity column trying
to import but getting error
Server: Msg 515, Level 16, State 2, Line 1
Cannot insert the value NULL into column 'ID', table 'MyTable; column
does not allow nulls. INSERT fails.
Note: Bulk Insert through a view may result in base table default
values being ignored for NULL columns in the data file.
The statement has been terminated.
Please help.
Thanks
--
FarhanUnless I am missing something, you should be able to import into the table
normally. Don't try to put anything in the Identity column. It will assign
the values automatically. Forget about creating a view to import into.
HTH
Paul
"fsoomro@.chartlinks.com" wrote:
> I am importing data in the table which has primary key as identity.
> Data file doesn't has the data for the column.
> I created view which has the column except the identity column trying
> to import but getting error
> Server: Msg 515, Level 16, State 2, Line 1
> Cannot insert the value NULL into column 'ID', table 'MyTable; column
> does not allow nulls. INSERT fails.
> Note: Bulk Insert through a view may result in base table default
> values being ignored for NULL columns in the data file.
> The statement has been terminated.
> Please help.
> Thanks
> --
> Farhan
>|||This works fine.
use northwind
go
create table t (colA int not null identity(1, 1) unique, colB varchar(25))
insert into t (colB) values('a')
insert into t (colB) values('b')
insert into t (colB) values('c')
execute master..xp_cmdshell N'bcp "select colB from northwind.dbo.t"
queryout d:\temp\test.tbl -Smyserver -T -c'
select * from t
delete t
go
create view myview
as
select colB from t
go
bulk insert northwind.dbo.myview
from 'd:\temp\test.tbl'
with
(
fieldterminator = '\t',
rowterminator = '\n'
)
go
select * from t
go
drop view myview
go
drop table t
go
execute master..xp_cmdshell N'del d:\temp\test.tbl'
go
AMB
"fsoomro@.chartlinks.com" wrote:
> I am importing data in the table which has primary key as identity.
> Data file doesn't has the data for the column.
> I created view which has the column except the identity column trying
> to import but getting error
> Server: Msg 515, Level 16, State 2, Line 1
> Cannot insert the value NULL into column 'ID', table 'MyTable; column
> does not allow nulls. INSERT fails.
> Note: Bulk Insert through a view may result in base table default
> values being ignored for NULL columns in the data file.
> The statement has been terminated.
> Please help.
> Thanks
> --
> Farhan
>sql
Sunday, February 19, 2012
Implicit Keep Together For Export?
Now nearly 5 months later is there _ANY_ hope to get this KeepTogether working properly? Searching the web I found some other people having that problem. Its working correct if you have few data and its working correct if you have much data, but if you have a certain amount in between this keeptogether bug appears.
|||now over a year later and a new version keeptogether is not avaliable on tables.. man this sucks!Implicit Keep Together For Export?
Now nearly 5 months later is there _ANY_ hope to get this KeepTogether working properly? Searching the web I found some other people having that problem. Its working correct if you have few data and its working correct if you have much data, but if you have a certain amount in between this keeptogether bug appears.
|||now over a year later and a new version keeptogether is not avaliable on tables.. man this sucks!Implicit Keep Together For Export?
Now nearly 5 months later is there _ANY_ hope to get this KeepTogether working properly? Searching the web I found some other people having that problem. Its working correct if you have few data and its working correct if you have much data, but if you have a certain amount in between this keeptogether bug appears.
|||now over a year later and a new version keeptogether is not avaliable on tables.. man this sucks!Implicit Keep Together For Export?
Now nearly 5 months later is there _ANY_ hope to get this KeepTogether working properly? Searching the web I found some other people having that problem. Its working correct if you have few data and its working correct if you have much data, but if you have a certain amount in between this keeptogether bug appears.
|||now over a year later and a new version keeptogether is not avaliable on tables.. man this sucks!