Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

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 Comments1 Solution133 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.