troubleshooting Question

how to read in a csv data dictionary and build SQL Server tables from it.

Avatar of Evan Cutler
Evan CutlerFlag for United States of America asked on
Microsoft SQL ServerSQL
14 Comments2 Solutions133 ViewsLast Modified:

I have a csv sheet that is a data dictionary.  It looks like this:

TableName	PhysicalTableName	PrimaryKey	ForeignKey	ForeignKey	FieldName	PhysicalFieldName	DATATYPE	LENGTH
 Owner Table	OWNER	X	Lease ID	API14	*Owner ID	*OWNR_ID	VARCHAR	50
 Owner Table	OWNER	Owner ID	Lease ID	API14	**Lease ID List	**LSE_ID_LIST	VARCHAR	50
 Owner Table	OWNER	Owner ID	Lease ID	API14	**API14 List	**API14_LIST	VARCHAR	50
 Owner Table	OWNER				Lease Count	LSE_CNT	VARCHAR	50

As you can see, this is not about importing a csv full of data.  This is a csv with schema metadata.
I need to know if there's a way in SQL Server to build the tables defined in this csv.  There are over 2000 lines in this document.
I'm hoping I don't have to run this manually.

If anyone has any ideas, I'd greatly appreciate it.
Join our community to see this answer!
Unlock 2 Answers and 14 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 14 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros