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
 General SQL Server Forums
 New to SQL Server Programming
 Import data help
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

w1102157
Yak Posting Veteran

80 Posts

Posted - 08/01/2012 :  14:32:15  Show Profile  Reply with Quote
HI guys

Is there any way i can important data from a flat file and keep the order of the data the same?

The order of the data is odd but i need this order to stay the same in the sql table.

is there any way?

webfred
Flowing Fount of Yak Knowledge

Germany
8513 Posts

Posted - 08/01/2012 :  14:34:00  Show Profile  Visit webfred's Homepage  Reply with Quote
There is never a reliable order of rows in a table. To get rows in a needed order you have to use ORDER BY in your select statement.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
47055 Posts

Posted - 08/01/2012 :  14:34:30  Show Profile  Reply with Quote
yep...you can . just add an identity column in sql table

and you can retrieve it in order you inserted based on identity value generated

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

w1102157
Yak Posting Veteran

80 Posts

Posted - 08/01/2012 :  14:35:11  Show Profile  Reply with Quote
i cant do that it wont work fro example i import data from a pipe file and the id order is
3
5
7
1
2
6

i need the table to keep it this way :(
Go to Top of Page

w1102157
Yak Posting Veteran

80 Posts

Posted - 08/01/2012 :  14:35:49  Show Profile  Reply with Quote
visakh how can i do this?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
47055 Posts

Posted - 08/01/2012 :  16:11:24  Show Profile  Reply with Quote
quote:
Originally posted by w1102157

visakh how can i do this?



as i suggested dump data onto table with additional identity column and then while retrieving use

ORDER BY ID

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

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.17 seconds. Powered By: Snitz Forums 2000