September 3, 2012 at 5:55 pm
SELECT FirstName + '' + LastName AS 'Employee Name'
FROM dbo.Employees
ORDER BY STR (LEN(FirstName + '' + LastName))
+ STR (CHARIDEX('a', @Location;)+ RIGHT('SUBSTRING', 5);
I keep getting and error message for the last line can you tell me what i am doing wrong...
September 3, 2012 at 6:27 pm
richesflow (9/3/2012)
SELECT FirstName + '' + LastName AS 'Employee Name'FROM dbo.Employees
ORDER BY STR (LEN(FirstName + '' + LastName))
+ STR (CHARIDEX('a', @Location;)+ RIGHT('SUBSTRING', 5);
I keep getting and error message for the last line can you tell me what i am doing wrong...
How do you spell CHARIDEX correctly?
--Jeff Moden
Change is inevitable... Change for the better is not.
September 3, 2012 at 6:51 pm
As Jeff poinged out you have a typo unless you were typing from memory and that's not how it is in your query. If that's the case, please let us know the exact error when you attempt to run your query.
Mark
September 3, 2012 at 8:38 pm
Sorry that was a typo... CHARINDEX
I tryied CHAR INDEX as well but an error keeps coming up.
September 3, 2012 at 10:29 pm
richesflow (9/3/2012)
SELECT FirstName + '' + LastName AS 'Employee Name'FROM dbo.Employees
ORDER BY STR (LEN(FirstName + '' + LastName))
+ STR (CHARIDEX('a', @Location;)+ RIGHT('SUBSTRING', 5);
I keep getting and error message for the last line can you tell me what i am doing wrong...
I guess there are few syntactical errors in above query.
e.g.typo in CHARINDEX , syntax error in CHARINDEX (i.e. 😉 and also a closing bracket is required for STR.
So please try out below query and if still no lock, please post the error message as well.
SELECT FirstName + '' + LastName AS 'Employee Name'
FROM dbo.Employees
ORDER BY STR (LEN(FirstName + '' + LastName)) + STR (CHARINDEX('a', @Location)+ RIGHT('SUBSTRING', 5))
--rhythmk
------------------------------------------------------------------
To post your question use below link
https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help
🙂
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply