Last post Jul 15, 2009 05:53 PM by __Aayan__
Jul 14, 2009 08:32 PM|__Aayan__|LINK
Can you help please? I want a select query statement which will collect data from a column where value starts with 'A' or with any character which i will provide.
Table Name: MyProducts
Column Name: ProductsCollection
I want a query like......
SELECT ProductsCollection from MyProducts WHERE ProductsCollection startswith(‘S’).
Result needs to be......:
Jul 14, 2009 08:40 PM|limno|LINK
DECLARE @letter CHAR(1)
SET @letter = 'a'
WHERE col1 LIKE @letter + '%'
In your case:
SELECT ProductsCollection from MyProducts WHERE ProductsCollection LIKE 'S%'
Jul 14, 2009 08:41 PM|CSharpSean|LINK
SELECT ProductsCollection from MyProducts WHERE ProductsCollection like 'S%'
Jul 14, 2009 08:43 PM|RatheeshC|LINK
SELECT ProductsCollection from MyProducts
Jul 14, 2009 11:24 PM|__Aayan__|LINK
Thanks guys that's great.
One more thing please. What if i want to get a similar word. For example, the value in database is 'Microsoft' but user enter it with wrong spelling like 'Micrsoft' ('o' is missing.). How can i query my database to get simillar words. Like in this example
i would like to show user the value Microsoft which my query will collect.
Jul 15, 2009 02:21 AM|Naom|LINK
That's much more tricky - you need to look / read up on Fulltext search.
Jul 15, 2009 05:53 PM|__Aayan__|LINK
Ok dear thanks for your reply!