Skip to content
Advertisement

Tag: sql-server

How to add split between duplicate value in SQL

I have SQL Server table that have duplicated value in field and need to split by slash character. All field start with alphabetical char end with ‘M’ char For example: and need to convert to: Thanks Answer Probably many ways to skin this cat, assuming you’re always looking for the same initial character repeated within the string, the following uses

SQL Server – Concatenate – Stuff doesn’t work

I have this query in SQL Server and I want to concatenate using stuff the ‘Products’ column, but I don’t know why this doesn’t work… And the result is: And I want this: Also I used SELECT DISTINCT in the query but the result is the same… So, where can be the mistake? Answer SQL Server 2017 and Later Versions

How find last number of sequence numbers in sql?

I want find last number of sequence in sql query for fill automatically suggestion field value. forexample my code field(column) is :1,2,3,4,10,20 so i want found 4 in my query Answer If your table is called table_name and looks like this: id 1 2 3 4 10 20 Then this should work: Fiddle

How to pass a list of strings as a parameter in a stored procedure in SQL?

How to pass a list of strings as a parameter in a stored procedure in SQL? Like for example if I have a stored procedure proc_aggregation that takes two parameters @Prod_Desc of varchar data type and another parameter @Prod_Code as a list of strings (Eg : @Prod_Code = (‘12012’, ‘12011’, ‘12014’)). Answer You will have to use table valued parameters

Advertisement