轉(zhuǎn)移數(shù)據(jù),導(dǎo)入excel數(shù)據(jù)操作記錄復(fù)制表數(shù)據(jù)
廣告:
一 復(fù)制新表帶數(shù)據(jù)(表備份)
select * into baokanhao.dbo.mvc_downtype from baokanhao.dbo.mvc_downclass
二 插入記錄:
1 sql查詢,選取1000行,取出字段名
2 導(dǎo)出表,生成腳本,獲取隨便一行數(shù)據(jù)(作為默認(rèn)數(shù)據(jù)用)
3 改 ryid為自增
truncate table [ICXFDB].[dbo].[ryxx]
insert into [ICXFDB].[dbo].[ryxx]([rfzt]
,[bmmc]
,[rybh]
,[ryxm]
,[rfkh]
,[rfye]
,[Mrfye]
,[bdje]
,[yj]
,[zhiwu]
,[mz]
,[jg]
,[LimitTime]
,[UserGB]
,[GBName]
,[LssjCount]
,[IDCardNo]
,[Phone]
,[Note1]
,[Note2]
,[Note3]
,[khrq]
,[Daterfye]
,[Checkjh]
,[ISXCXE]
,[mima]
,[xc1]
,[xc2]
,[xc3]
,[xc4]
,[dayxe]
,[xfjc]) select 32, a.[bmmc], a.[rybh],a.[ryxm], a.[rfkh], CAST(a.[rfye] AS money) , 0.0000, 0.0000, 0.0000, N'', N'漢族', N'', CAST(0x00011BEC00000000 AS DateTime), 1, N'1', 1, N'', N'', N'', N'', NULL, getdate(), NULL, 0, 0, N'FFFFFF', 255, 255, 255, 255, 6000.0000, 0 from [ICXFDB].[dbo].[Sheet3] as a order by [消費(fèi)時(shí)間] desc
提示不允許從數(shù)據(jù)類型 nvarchar 到數(shù)據(jù)類型 money 的隱性轉(zhuǎn)換
SELECT CAST(your_nvarchar_column AS money) FROM your_table;
-- 或者
SELECT CONVERT(money, your_nvarchar_column) FROM your_table;
insert into [ICXFDB].[dbo].[ryxx]([rfzt]
,[bmmc]
,[rybh]
,[ryxm]
,[rfkh]
,[rfye]
,[Mrfye]
,[bdje]
,[yj]
,[zhiwu]
,[mz]
,[jg]
,[LimitTime]
,[UserGB]
,[GBName]
,[LssjCount]
,[IDCardNo]
,[Phone]
,[Note1]
,[Note2]
,[Note3]
,[khrq]
,[Daterfye]
,[Checkjh]
,[ISXCXE]
,[mima]
,[xc1]
,[xc2]
,[xc3]
,[xc4]
,[dayxe]
,[xfjc]) select [rfzt]
,[bmmc]
,[rybh]
,[ryxm]
,[rfkh]
,[rfye]
,[Mrfye]
,[bdje]
,[yj]
,[zhiwu]
,[mz]
,[jg]
,[LimitTime]
,[UserGB]
,[GBName]
,[LssjCount]
,[IDCardNo]
,[Phone]
,[Note1]
,[Note2]
,[Note3]
,[khrq]
,[Daterfye]
,[Checkjh]
,[ISXCXE]
,[mima]
,[xc1]
,[xc2]
,[xc3]
,[xc4]
,[dayxe]
,[xfjc] from [ICXFDB].[dbo].[ryxx_20241018] as a
三 除掉重復(fù)姓名的數(shù)據(jù) ryid>444
四 改ryid自增改為不是自增字段
備注:
復(fù)制表數(shù)據(jù)到另外庫(kù)同名表:
insert into ylgxyy.dbo.dm_yk select * from gxyy.dbo.dm_yk
復(fù)制同名表數(shù)據(jù)(備份)
select * into ylgxyy.dbo.ls_yzcf_bak from gxyy.dbo.ls_yzcf
復(fù)制表數(shù)據(jù)插入指定列數(shù)據(jù):
insert into AIS20230509101657.dbo.t_Account([FAccountID] ,[FOnlyForIndustry]) select [FAccountID],[FOnlyForIndustry] from AIS20230509101657rec.dbo.t_Account
廣告: