SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How can I specify Import field constraints?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

parrot
Posting Yak Master

USA
132 Posts

Posted - 12/30/2012 :  13:05:45  Show Profile  Reply with Quote
I am trying to import a delimited flat file data source into a table that I have created with the desired attributes using SQL Server Management Studio. I started by exporting the table as a flat file. Then I created the table definitions on the new database. Then I imported the flatfile source into my new table but it gives me an error that the table is already defined. If I don't define the table ahead of time, the flat file will just create a varchar(50) attribute for every field item. So how can I import a table from a delimited flat file into a table with an existing definition so I can retain the proper field definitions?
Dave

jimf
Flowing Fount of Yak Knowledge

USA
2869 Posts

Posted - 12/30/2012 :  16:53:22  Show Profile  Reply with Quote
Are you importing it somehow as SELECT * INTO AlreadyCreatedTable instead of
INSERT INTO AlreadyCreatedTable
SELECT *
FROM

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

parrot
Posting Yak Master

USA
132 Posts

Posted - 12/30/2012 :  17:48:32  Show Profile  Reply with Quote
I am importing under the tasks menu item as a flat file which only has comma delimited data. I am not running any script. I know that in MYSQL you can use a LOAD DATA INFILE command but there is no such command that I know of in Microsoft SQL. I tried to use a LOAD DATA INFILE command in a script and got an error. Is there an SQL script command that allows me to upload data from an input file?
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.11 seconds. Powered By: Snitz Forums 2000