GC_DevUser库中gc_department表
dp_id int
dp_parentid int
dp_name varchar(100)
dp_sort_seq int
DevTrackerMy库中Organization表
Id int
Name nvarchar(50)
State bit
ParentId int
OrgTypeId intdp_name与Name对应 dp_parentid与ParentId对应其他不用考虑
dp_id int
dp_parentid int
dp_name varchar(100)
dp_sort_seq int
DevTrackerMy库中Organization表
Id int
Name nvarchar(50)
State bit
ParentId int
OrgTypeId intdp_name与Name对应 dp_parentid与ParentId对应其他不用考虑
解决方案 »
- sql server 2000中的数据库维护计划无法删除早于此时间的文件
- 急列中最大,最小值,平均值的sql语句
- 关于动态表查询的问题
- 如何得到update后,影响的行数?
- 我在建立外键时,报“不存在主键或不唯一” 请问是什么问题?
- 请教关于联合查询的语句
- 俺只用微软提供的ado控件还能直接访问ms sql server阿
- 请问关于日期的比较,急!!!!!!!!
- 英文版windows2000 和英文版sqlserver2000中如何使用中文
- sos!!!SQL SERVER2000中数据类型text,image
- 机器启动后,右下角的系统托盘中没有“sqlserver2000的服务器图标了”,如果解决。
- sqlserver2000查询问题,解决马上给分
select ParentId,Name from DevTrackerMy..Organizationor:
insert DevTrackerMy..Organization( ParentId,Name)
select dp_parentid,dp_name from GC_DevUser..gc_department
insert into DevTrackerMy.dbo.Organization(Id,Name,State,ParentId,OrgTypeId )
select null,dp_name,null,dp_parentid,null from
GC_DevUser.dbo.gc_department
DEFAULT or NULL are not allowed as explicit identity values.
select ParentId,Name,0 from DevTrackerMy..Organization或者insert DevTrackerMy..Organization( ParentId,Name,State,OrgTypeId)
select dp_parentid,dp_name,0,0 from GC_DevUser..gc_department
DEFAULT or NULL are not allowed as explicit identity values
-----------------說明Organization表的Id列是自增列
試試這個:
insert DevTrackerMy.dbo.Organization
select dp_name, null, dp_parentid, null
from GC_DevUser.dbo.gc_department
Violation of PRIMARY KEY constraint 'PK__Organization__65370702'. Cannot insert duplicate key in object 'dbo.Organization'.
这个是什么问题?
Set Identity_Insert DevTrackerMy.dbo.Organization On
insert into DevTrackerMy.dbo.Organization(Id,Name,Describe,State,ParentId,Email,OrgTypeId )
select dp_id,dp_name,'1','False',dp_parentid,'1','1' from
GC_DevUser.dbo.gc_department
Set Identity_Insert DevTrackerMy.dbo.Organization OFF把主见和自增去掉后报
Msg 8106, Level 16, State 1, Line 1
Table 'DevTrackerMy.dbo.Organization' does not have the identity property. Cannot perform SET operation.
select dp_name,'1','False',dp_parentid,'1','1' from GC_DevUser.dbo.gc_department
Msg 545, Level 16, State 1, Line 2
Explicit value must be specified for identity column in table 'Organization' either when IDENTITY_INSERT is set to ON or when a replication user is inserting into a NOT FOR REPLICATION identity column.
如果我把自增去掉 如何给Id负个值 就是直接拷贝
采用“..",DTS.
还有用户权限问题。