SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


read notepad file in sql server 2005


read notepad file in sql server 2005

Author
Message
pankaj.kuchaliya
pankaj.kuchaliya
Valued Member
Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)

Group: General Forum Members
Points: 66 Visits: 234
Hi,

i have attached notepad file. i have one problem , how can i read the notepad file in sql server 2005.
Please reply.
Attachments
test.txt (27 views, 12.00 KB)
irobertson
irobertson
Old Hand
Old Hand (313 reputation)Old Hand (313 reputation)Old Hand (313 reputation)Old Hand (313 reputation)Old Hand (313 reputation)Old Hand (313 reputation)Old Hand (313 reputation)Old Hand (313 reputation)

Group: General Forum Members
Points: 313 Visits: 675
Hi Grasshopper,

You're going to struggle to work with the file in the format it's in. SQL needs your data to be organised into discrete entities with rows and columns. Your file is organised with data on alternate rows and has metadata embedded within the data structure itself.

If it was me, I'd write a VB script to process the data first. But then, I'm a bit old fashioned :-)

Regards, Iain
steve-893342
steve-893342
Mr or Mrs. 500
Mr or Mrs. 500 (567 reputation)Mr or Mrs. 500 (567 reputation)Mr or Mrs. 500 (567 reputation)Mr or Mrs. 500 (567 reputation)Mr or Mrs. 500 (567 reputation)Mr or Mrs. 500 (567 reputation)Mr or Mrs. 500 (567 reputation)Mr or Mrs. 500 (567 reputation)

Group: General Forum Members
Points: 567 Visits: 2670
Does this help you?

SELECT BulkColumn FROM OPENROWSET (BULK 'C:\test.txt', SINGLE_CLOB) AS Z


pankaj.kuchaliya
pankaj.kuchaliya
Valued Member
Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)

Group: General Forum Members
Points: 66 Visits: 234
irobertson (9/1/2010)
Hi Grasshopper,

You're going to struggle to work with the file in the format it's in. SQL needs your data to be organised into discrete entities with rows and columns. Your file is organised with data on alternate rows and has metadata embedded within the data structure itself.

If it was me, I'd write a VB script to process the data first. But then, I'm a bit old fashioned :-)

Regards, Iain


Thanks for reply.
Can you please tell me how can i read it by script.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search