Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query to parse data properly

Author  Topic 

davelalande
Starting Member

3 Posts

Posted - 2011-12-28 : 10:17:25
I have some police blotter data I receive daily and am [url=http://quincymagazine.com/News/GeneralNews/PoliceFeed.aspx]publishing for a small town portal.[/url] Unfortunately it comes in as an attachment and the software I am using to automatically publish it doesn't recognize the codes in the attachment. I am trying to figure out a way to make it more readable. As is now the text is all run together.

The text includes a case number at the beginning of each entry formatted like this XX-XXXXX. If I could figure out how to run a query against to format the text that would add a carriage return before each XX-XXXXX, this would make the text much more readable / useful.

Any suggestions on what the query should look like?

Thanks for any help you can lend me.

Dave

X002548
Not Just a Number

15586 Posts

Posted - 2011-12-28 : 11:13:32
Do I get a "get out of jail free" CARD?


Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

davelalande
Starting Member

3 Posts

Posted - 2011-12-28 : 11:16:36
quote:
Originally posted by X002548

Do I get a "get out of jail free" CARD?


Brett

8-)



Yes... :)
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2011-12-28 : 11:22:00
OK

FIRST

Try using CHARINDEX

Can you do a SELECT That shows you the data you want?

DO you know what Books Online (BOL) Is?

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

davelalande
Starting Member

3 Posts

Posted - 2011-12-28 : 14:04:11
quote:
Originally posted by X002548

OK

FIRST

Try using CHARINDEX

Can you do a SELECT That shows you the data you want?

DO you know what Books Online (BOL) Is?

Brett

8-)




I am a babe in the woods as it pertains to SQL. I cobbled together a query to truncate a table, but other than that, I don't know much. I can find the table and field that needs parsed, but I wouldn't know how to look for "XX-XXXXX" within the text and insert a carriage return before each, then move to the next record.

I will find the table and field names that the data is report back here.

Thanks,

Dave
Go to Top of Page
   

- Advertisement -