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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Way to add concationation to search?

Author  Topic 

lauramayer
Posting Yak Master

152 Posts

Posted - 2005-09-01 : 10:34:05
Morning,

Is there a way to add a prefix to a search criteria? I have this query where I have to prepend 'V-' to the search criteria.

This is the query:


SELECT distinct TrailerID
from Yardcheck.dbo.vwTrailerHistory
where TrailerID = 'V + '-' + 525678'


It doesn't work of course but I can't seem to make it add the V- value.

Thanks as always for any help

Laura

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-09-01 : 10:36:13
If TrailerId column is varchar datatype, then try this

SELECT distinct TrailerID
from Yardcheck.dbo.vwTrailerHistory
where TrailerID = 'V-' + '525678'


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

lauramayer
Posting Yak Master

152 Posts

Posted - 2005-09-01 : 10:37:31
Bloody brilliant

Thanks so much

Laura
Go to Top of Page
   

- Advertisement -