当前位置:Gxlcms >
数据库问题 >
SQL SERVER 实现多个数据库之间表的联系,利用临时表枚举表中行数据
SQL SERVER 实现多个数据库之间表的联系,利用临时表枚举表中行数据
时间:2021-07-01 10:21:17
帮助过:15人阅读
SET IDENTITY_INSERT [User] on;
SELECT ROW_NUMBER()
OVER (
ORDER BY EmpID ) i,
* INTO #A
FROM [GMSToolManage].dbo.
[employees];
DECLARE @count INT;
SELECT @count=COUNT(
1)
FROM #A;
DECLARE @i INT=1;
DECLARE @ID INT;
WHILE(
@i<=@count)
BEGIN
INSERT INTO [GMSAccount].dbo.
[User](ID,Workcell,EmpID,Name,Sex,PhoneNo,Birthday,LoginName)
SELECT
@i+2,
1,EmpID,Name,Sex,PhoneNo,Birthday,EmpID
FROM #A
WHERE i
=@i;
SET @i=@i+1;
END
UPDATE tb1
SET tb1.Password
=‘96-E7-92-18-96-5E-B7-2C-92-A5-49-DD-5A-33-01-12‘,
--111111
tb1.Headportrait
=‘\Upload\default.jfif‘,
tb1.Email=‘default@default.com‘
FROM [GMSAccount].dbo.
[User] tb1
WHERE tb1.Workcell
=1
--if OBJECT_ID(‘tempdb..#A‘) is not null drop table #A;
SQL SERVER 实现多个数据库之间表的联系,利用临时表枚举表中行数据
标签:object employees -- too font 临时表 pass word email