将CSV文件中的数据加载到多个表中 [英] Loading data from CSV file into Multiple Tables

查看:69
本文介绍了将CSV文件中的数据加载到多个表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我必须将.csv文件中的数据加载到几个具有参照完整性的sql server表中。

什么是加载数据的最佳方法任何参照完整性或其他问题。

它是通过SSMS导入任务轻松还是编写脚本方式?
b
$
表1 ==> PK col +一些列 

表2 ==> PK +一些列+ FK到TABLE1

表3 ==> PK +一些列

表4 ==> PK +一些列+ FK到TABLE2

表5 ==> PK +一些列+ FK到TABLE2和TABLE3

表6 ==> MAster表包含所有其他表PK列作为FK +其他一些列

注意:其他一些列我的默认值也像User(SUSER)和DAteCol是GETDATE()

您的输入非常感谢!



谢谢

Hi,
I‌ have to load the data from .csv file into few sql server tables which have referential integrity also.
W‌hat's the best way to load data without any referential integrity or other issues.
I‌s it through SSMS import task easy or scripting way?

T‌able 1 ==> PK col + some columns 
T‌able 2 ==> PK+ some columns + FK to TABLE1
T‌able 3 ==> PK+ some columns
T‌able 4 ==> PK + some columns + FK to TABLE2
T‌able 5 ==> PK + some columns + FK to TABLE2 and TABLE3
T‌able 6 ‌‌‌‌==> Kind of MAster Table which contains all other tables PK columns as FK + some other columns
N‌ote: Some of other columns i have default value also like User (SUSER) and DAteCol is GETDATE()
Y‌our input greatly appreciated!

T‌hanks‌

推荐答案

将其加载到临时表中的最佳方法然后从那里处理


请参考:

https://stackoverflow.com/questions/14247057/import-csv-into-sql-multiple-tables


 


希望这会有所帮助!

------------------------------------------- -------------------------------------------------- --------

请不要忘记" mark
回复为答案
"
如果他们帮助 ,也设置" 喜欢 "
这对我们保持博客提升
J

Please don't forget to "markthe replies as answers"if they helped, also set "like" it’s a boost for us to keep blogging J

点击  here  到
了解详情。访问专用  社区
foru m
 到 分享 ,  探索  和  talk  &
关于Microsoft Kaizala的专家。

Click here to learn more. Visit the dedicated Community forum to shareexplore and talk to experts about Microsoft Kaizala.





这篇关于将CSV文件中的数据加载到多个表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆