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
 Very New - Need text in string to link to field

Author  Topic 

Battlesql
Starting Member

2 Posts

Posted - 2011-06-30 : 10:59:40
I'm using CR XI. I only know the very basics needed for reports in SQL. And I'm stuck. We have a text or note field that has a # followed by 4,5 or 6 numbers in the text. The position is consistent. Position 9 to 13. I need to extract that number to use to link to a second table with a field which records should match those numbers. In other words we have a user log that states Reorder #xxxx on 3/2/2001.... And I have a table that contains Reorder info, like item description, qty... I need to link these two. Is there a set of commands to pull the 9th - 13th position of the string and link it to the RO# in the Reorders table?

I've serach where I know for the correct syntax but there are so many variables in its use I can't make heads or tales of it.

Please help a newbie.

AW

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-06-30 : 11:16:16
To extract the needed value this is the solution:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=162430
Just replace the value for @key with 'Reorder #'


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

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2011-06-30 : 11:33:57
How can you have 6 numbers in postions 9 - 13 ?

try substring(yourColumn,9,5) if postions 9 - 13 are used exclusively for the numbers you're looking for

Jim

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

Battlesql
Starting Member

2 Posts

Posted - 2011-06-30 : 11:59:47
oof, sorry my math is off. It's 5 numbers with the 6th being the #.
Don't want the #.

And thank you SOOO much for the quick replies. I've got it going - so far, so good!

Thanks again! This is a great forum.

aw
Go to Top of Page
   

- Advertisement -