Skip to content

Tag: sql-server

Repeating rows but changing column value each time

I’ve this table with the following data: ID  Quantity Status 1    250      OK   2    440      HOLD 3    180      HOLD 4    860      OK Based on the value in the Quantity column for each row, the row should be repeated again if Quantity is bigger than 200, but repeated

SQL Server 2014 slow remote insert

I have several linked servers and I want insert a value into each of those linked servers. On first try executing, I’ve waited too long for the INSERT using CURSOR. It’s done for about 17 hours. But I’m curious for those INSERT queries, and I checked a single line of my INSERT query using Di…

How to split string with delimiter and get the first value

I have the following query where I have a table which is storing from information with a delimiter SQL version – Microsoft SQL Azure (RTM) – 12.0.2000.8 Getting the following results Where I need the results to be Answer If you only interested in the first value, you don’t need to use STRING…

How to add a query to a table in SQL?

I have 3 tables. For simplicity I changed them to these sample tables. table1: CorporateActionSmmary table2# ProductMaster table3# OpenPosition First I need to add ISIN from table2 to table1 table1: CorporateActionSmmary So, I used this code Now as you can see the Quantity is missing in Table1 so I have to ad…