Query Help using SQL Server

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?
amj1020 [ Di, 11 September 2007 18:05 ] [ ID #1817419 ]

Re: Query Help using SQL Server

amj1020 (angelicred19 [at] hotmail.com) writes:
> 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.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downlo ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books .mspx
Erland Sommarskog [ Di, 11 September 2007 23:36 ] [ ID #1817427 ]
Datenbanken » comp.databases.ms-sqlserver » Query Help using SQL Server

Vorheriges Thema: Can't log in as sa
Nächstes Thema: integratedSecurity login from Linux -> SQL Server 2005?