Let's say I pass this parametre value "aboutme" to my Stored procedure. In my table "PagesTable" I have a column named "PageName" that has values like "About Me" , "About Company", etc. Now what I want is compare the parametre passed (aboutme ie) with these column values. So I need to first convert the column values to lower case and remove the spaces in between and only then can I compare.
Someone please tell me how do you accomplish this in MSSQL? Any help will be greatly a开发者_开发百科preciated. Thanks :)
DECLARE @yourString VARCHAR(100)
SET @yourString = 'HI HOW ARE YOU'
SELECT LOWER( REPLACE( @yourString, ' ', '' ) )
For comparison against a value
WHERE LOWER( REPLACE( ColumnName, ' ', '' ) ) = @val
精彩评论