TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Aniket Narvankar
562
2.1k
605.1k
Sql Query
Mar 21 2016 3:05 AM
I have tables in database from TableA to TableZ that is 26 Tables.
I was asked a question in an interview if Suppose a string comes as 'Abcdef' then its first character is A A so it should be inserted into TableA,if Suppose first character is B then it should be inserted into TableB
I wrote it like this
Declare @Name varchar(50),@var varchar(50),@tbl varchar(50)
Set @Name = 'ABCDEFG'
Set @var = Substring(@Name,1,1)
if(@var = 'a')
insert into tblA (Name) values (@Name)
but this is the wrong way the interviewer told me there will be a need to write 26 times if else.Please do let me know how to solve the above question as I am stuck on it.
Reply
Answers (
4
)
upload user image and shown when that user login
without using reverse find the given string palindrome or no