Skip to content

Tag: tsql

What is the syntax of a string literal in T-SQL?

What is the full syntax of a string literal in T-SQL? I could not find any explicit definition of string syntax in the official documentation, and any blog post I could find only mentioned certain aspects (like the N prefix). Additionally, any posts on Stack Overflow or other sites that asked how to escape a …

Build change history from table with historical row values

I have table that is storing historical values for data in other table: Now I need to generate from such table “change log” which will show what was old value, new value and when update occur: Unfortunately, I can’t change structure of the existing table and can’t put old value there, …

Sql Grouping insight Xml

I need to get different row data to 1 row based with id and need to group by its status. I tried in several ways and finally found a solution using xml, but when I use xml I don’t get the output I want. This is a sample code I used to try the logic. returned output: expected output: Answer

Update duplicate data with same unique-identifier

I have the following table in my database: So I want to generate Unique-identifier and Update the UniqueID column as shown below: If values of UniqueID are the same, then they must have the same Uniqueidentifier. I have tried to write a CTE as below: But am not getting what am looking for. Very knew to the wo…

Not able to display Chinese character in application

I have a column in which Chinese characters are stored and the column contains a customer name in Chinese language. When I select the column in SSMS I can see all the names in Chinese language but when the same is done from application the application displays ‘??????’ in all the fields of that co…