Updating the left side of a string up to a delimiter

My column "ColumnOne" in my table "MyTable" has values like this: Delimiter is character ‘-‘ |Something | |Something – SomeOtherThing | |Something – SomethingElse | |Something – Whatever | |OtherThing – | I want to update the values so eventually it look like this: |Something | | SomeOtherThing | | SomethingElse | | Whatever |… Read More Updating the left side of a string up to a delimiter

sql query for counting the records of particular id and show in column

I have a following table:- declare @tab table(name varchar(10),id int) insert into @tab values (‘A’,1),(‘B’,1),(‘C’,1),(‘D’,1),(‘E’,2),(‘F’,2) I need following output:- declare @tab1 table(name varchar(10),id int, cnt int) insert into @tab1 values (‘A’,1,4),(‘B’,1,4),(‘C’,1,4),(‘D’,1,4),(‘E’,2,2),(‘F’,2,2) select * from @tab1 I tried following query:- select name,id,count(*) as cnt from @tab group by name,id Thanks >Solution : Try this select name… Read More sql query for counting the records of particular id and show in column

How to check with different table and update it in SQL Server

I’m trying to write a script and do the following steps in my db. Read records (where CreatedDate = 06/06/2022 AND Status = Processed) from Daily_Proc table. Check if any particular record is also existed in Lit_Hold_Err table using ‘MID’ and ‘Source’ columns value. If a particular record is existed in Lit_Hold_Err table then update… Read More How to check with different table and update it in SQL Server