Tech
Forums
Jobs
Books
Events
Live
Interviews Prep
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
5
Reply
Query to split string from comma
Prasad Anumolu
Feb 10 2016 3:15 AM
447
Reply
DECLARE @str varchar(50)='Hello, world'; /* SQL SERVER QUERY TO SPLIT STRING FROM COMMA AND GET LEFT AND RIGHT PART */
SELECT LEFT(@str, CHARINDEX(',', @str)-1) as LeftPart, RIGHT(@str, LEN(@str)-CHARINDEX(',', @str)) as RightPart;
Error is
Must declare the scalar variable "@str"
why it is coming ? if any one know tell me friends
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
5
)
Next Recommended Forum
How a Non-clustered indexing is best and in which scenario?
How to restrict to anyone that he can't b modified db in sql