dbTalk Databases Forums  

Query Help using SQL Server

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss Query Help using SQL Server in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
amj1020
 
Posts: n/a

Default Query Help using SQL Server - 09-11-2007 , 11:05 AM






Need help with a query.
I need to get a date from table1 where the symbol is equal to OQY7 but
the symbol in table table2 is OQY07.
How do I get it to look for the first three characters plus the fifth
character by skipping the fourth character?


Reply With Quote
  #2  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Query Help using SQL Server - 09-11-2007 , 04:36 PM






amj1020 (angelicred19 (AT) hotmail (DOT) com) writes:
Quote:
Need help with a query.
I need to get a date from table1 where the symbol is equal to OQY7 but
the symbol in table table2 is OQY07.
How do I get it to look for the first three characters plus the fifth
character by skipping the fourth character?
Use the substring() function. Or left() and right(). All of them are
described in Books Online. I recommend you to look at all string functions,
because you don't know which one you may need next.



--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.