I have a #tmp table that looks like the following. It has a total of three lines. title receipt_date decision_date “It wasn’t as bad as I thought it would be” 2017-06-12 15:07:10.893 2017-06-23 09:37:31.667 “It wasn’t as bad as I thought it would be” 2017-07-11 10:35:24.337 2018-06-25 05:54:41.133 “It wasn’t as bad as I thought it would be” 2017-09-25 14:06:18.670
Tag: cursor
Reverse to STRING_AGG
Here is a sample data on which we are further processing. My question is, is there any exact reverse of the STRING_AGG function for SQL Server? Like I am merging using STRING_AGG with the following code I need to reverse the process but I had to use CURSOR so I am searching for an alternative solution. Below is the cursor
how to resolve error while using grant admin option in execute immediate
I am trying to run the below script. My script works fine without ‘ WITH ADMIN OPTION’ in EXECUTE IMMEDIATE. But when using ‘ WITH ADMIN OPTION’ i get below error. “Error report – ORA-00900: …
T-SQL – adding more date values to a table all rows
I have a table that contains many IDs as random numbers and I would like to create another table that contains all the IDs with another column having dates from first day of the year until a specific date. For example: My actual table looks like: And I would like to have a table if my specific end date is
Concate string into temp table in cursor
I have a temp table structure @temp2 like this and would like to add the driverID column with a result like 5555, 68989 to do this, I use the cursor to loop another table look like this Here is the code sadly, I got the driverID column is null and would like to have finalized temp table look like this:
SQL Query, loop through data
I have a database with the following fields: UserID, DateRecorded and Score. A new entry is added to the table each time the score is updated. Here is an example of a user record: From the query I would like it to show me only the scores of all users with the earliest DateRecorded. Although not much familiar with cursors,