Well, the row number is calculated, so you can just update your table and then re-run the query to get the new row numbers. If you want the numbers to be static after you generate the query, perhaps insert the results into a temp table or something like that, then work on that table.
I believe that track was called "Ripped" and was included with license as part of the Camtasia studio selections.. 2019 or 2020 version iirc. I thought it was groovy!
@@seanmackenziedataengineering hmm let me give you an example: I made a query that selects data based on a search criteria and want a sequence number related to each one of the items of this data, then a process unrelated to SQL does things with that data so it does not fit with the search criteria. What I need is that, whenever new data comes in that fits the search data, the sequence number continues where it was left
I don't see why not! Give it a try. It may slow down though. At a point, you may want to just add a column to that table and make it persistent (and faster to work with).
If you are creating a new table, you can use a default to fill values that are not selected. If you wanted a date for example, you could make the field: MyDateField datetime default GetDate()
how do you update your table with the serial row number
Well, the row number is calculated, so you can just update your table and then re-run the query to get the new row numbers. If you want the numbers to be static after you generate the query, perhaps insert the results into a temp table or something like that, then work on that table.
is it necessary to use order by function in the row_number function ?
Yes, order by is required.
GREAT explanation.
Glad it was helpful!
Hello Sean, do you have a copy of the dataset in this discussion? I hope you do have so we can try it by ourselves. Thanks
Yes I'll take a look today and see! You will need to put it on your SQL Server. Thanks!
very well explained, thank u!
Glad it was helpful!
Nice video! I enjoyed the intro song, but people have different expectations i guess. Who is playing and what song is it? Had a nice riff
I believe that track was called "Ripped" and was included with license as part of the Camtasia studio selections.. 2019 or 2020 version iirc. I thought it was groovy!
is there a way that the row number continues the sequence after running the same query again?
Great question. It should continue generating more numbers if you added rows to the table, then executed the query again. Is that what you mean?
@@seanmackenziedataengineering hmm let me give you an example: I made a query that selects data based on a search criteria and want a sequence number related to each one of the items of this data, then a process unrelated to SQL does things with that data so it does not fit with the search criteria. What I need is that, whenever new data comes in that fits the search data, the sequence number continues where it was left
Sir, will these rownum work for table with million record
I don't see why not! Give it a try. It may slow down though. At a point, you may want to just add a column to that table and make it persistent (and faster to work with).
How to update empty column a value in declare table
If you are creating a new table, you can use a default to fill values that are not selected. If you wanted a date for example, you could make the field:
MyDateField datetime default GetDate()
The background music is very distracting.
Thanks for the feedback! All my newest videos removed the intro music.
Check out the mirror and you'll see a crybaby who cries about music and should have bigger fish to fry