extracting data

Last Post 20 Apr 2005 03:50 AM by Ado_SQL. 4 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
samkry
New Member
New Member

--
19 Apr 2005 11:55 PM
Hi can anyone tell me how should I extract data with below format..
currently I only use EM export tool but it's not possible while we have an interface and to have the data as such below format..

2304954,"33747AEF ",2004-10-02 15:17:12.290000000,2004-10-04 10:58:58.427000000,"MMRMINA038515","PMRMINA001309",2004-10-04 10:58:58.427000000,"CU5",37,350,"051-07633647","","","","33747AEF","C95MEU2QZC","229596OM","04412880652772272456195341","ODMCP00203005-114-01","01","229596","","",""
Ado_SQL
New Member
New Member

--
20 Apr 2005 03:50 AM
It is unclear as to what you are trying to achieve, are you exporting the data into a comma delimited text file from which you subsequently wish to extract data or is the string within a database that you wish to export, using the export wizard, into some kind of meaningful format? In either case you may be well advised to export to a csv file if this is of a more valuable format.

You mention an interface, is this bespoke, does it rely on TSQL statements behind the scene to grab data? If so you may want to consider the use of the charindex function (see BOL) as an example;

select left('2304954,"33747AEF ",2004-10-02 15:17:12.290000000,2004-10-04 10:58:58.427000000,"MMRMINA038515","PMRMINA001309",2004-10-04 10:58:58.427000000,"CU5",37,350,"051-07633647","","","","33747AEF","C95MEU2QZC","229596OM","04412880652772272456195341","ODMCP00203005-114-01","01","229596","","","" ',charindex(',','2304954,"33747AEF ",2004-10-02 15:17:12.290000000,2004-10-04 10:58:58.427000000,"MMRMINA038515","PMRMINA001309",2004-10-04 10:58:58.427000000,"CU5",37,350,"051-07633647","","","","33747AEF","C95MEU2QZC","229596OM","04412880652772272456195341","ODMCP00203005-114-01","01","229596","","","" ')-1)

would return 2304954, which is the first part of your string.

I may have missed the gist of your question entirely, but this may provoke some thought or further contribuition.

HTH
samkry
New Member
New Member

--
24 Apr 2005 11:55 PM
Hi.
What I need is rather than use import export wizard, can we just use sql statement to have the data as that format..
so if the column contains int it will not have "" symbol but if it char yes it shoould have then even if i extract the null colum it still keep the string//
Ado_SQL
New Member
New Member

--
25 Apr 2005 09:24 PM
I think you have asked this question again elsewhere. However one possible way to get close to what you require is to use concatenation, remember however that you will have to use cast and convert to change all the data types to the same data type and you will need to set concat_null_yields_null to off to preserve things where a null exists, search BOL (index) for CONCATENATION for details and positive examples.

HTH
samkry
New Member
New Member

--
03 May 2005 08:38 PM
But if I use concatenation, the values will consider as one data type, as u know csv format will display double quote for char value and if we open up in excel it will sorted by column, this is what i wanted to...
You are not authorized to post a reply.

Acceptable Use Policy