| Quick Search |
Return Multi Row value in a single column with comma seprated using sql
I want Return output like 1,2,3,4,5 using sql.
There is one table in which has column
id name
1 Dilip
2 Dinesh
3 Varun
4 Dhanpat
5 Renuka
solution:
declare @a varchar(500)
set @a = ‘ ‘
select @a = @a + cast(id as varchar(20)) + ‘,’ from tablename
if … Read More
If column value is in 1,2,34,23,44,444,12,23,… format than how can check the value using like operator in Sql. means if the coma separated value is in column in any table then how can check the value using like operator in Sql.
solution:
select * from s
where
sid like ’44,%’ or sid like ‘%,44,%’
or … Read More
This article demonstrate how to search a table in database using sql query :-
Solution:- select * from information_schema.tables where table_name like ‘%abc%’
where abc is table name
This article demonstrate how to search a table column in database using sql query :-
solution:-
use databasename
select it and execute and then write this query and execute it . it will give all the table in wich there will be the column name like you search.
select * from information_schema.columns where column_name … Read More
Use case for update the table value using sql query
Ex. table Gender_tbl and like this
id Gen_Name
1 Male
2 Male
3 Female
4 Femal
5 Male
no I have to update Gen_Name Male with M and Femal with F
solution:
UPDATE GENDER_TBL SET Gen_Name= (CASE WHEN (Gen_Name=’Male’) THEN ‘M’ WHEN (Gen_Name=’Female’) THEN ‘F’ else ‘ ‘ end)