What is the equivalent of therecno() function in t-sql
I need to fill a column called recnbr with the record number of each line
In VFP it would be:
update mytable set recnbr = recno()
But since there is no recno() function in t-sql, what would be a replacement?
TIA
Rafael Copquin
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
Have a look at SELECT ROW_NUMBER() OVER(.....) AS Recnbr,x,y,z
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Rafael Copquin Sent: Thursday, 5 July 2018 5:30 AM To: profoxtech@leafe.com Subject: recno() function in t-sql
What is the equivalent of therecno() function in t-sql
I need to fill a column called recnbr with the record number of each line
In VFP it would be:
update mytable set recnbr = recno()
But since there is no recno() function in t-sql, what would be a replacement?
TIA
Rafael Copquin
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
[excessive quoting removed by server]
Thank you
El mié., 4 de jul. de 2018 17:29, Darren foxdev@ozemail.com.au escribió:
Have a look at SELECT ROW_NUMBER() OVER(.....) AS Recnbr,x,y,z
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Rafael Copquin Sent: Thursday, 5 July 2018 5:30 AM To: profoxtech@leafe.com Subject: recno() function in t-sql
What is the equivalent of therecno() function in t-sql
I need to fill a column called recnbr with the record number of each line
In VFP it would be:
update mytable set recnbr = recno()
But since there is no recno() function in t-sql, what would be a replacement?
TIA
Rafael Copquin
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]
I searched the internet and found an alternative answer that works
DECLARE @id INT SET @id = 0 UPDATE mybase.dbo.invoices SET @id = recnbr = @id + 1 GO
The above filled the recnbr column with a sequence of numbers starting with 1 incrementing by 1, which was my purpose
Thnaks again
Rafael
El 05/07/2018 a las 9:13, Rafael Copquin escribió:
Thank you
El mié., 4 de jul. de 2018 17:29, Darren <foxdev@ozemail.com.au mailto:foxdev@ozemail.com.au> escribió:
Have a look at SELECT ROW_NUMBER() OVER(.....) AS Recnbr,x,y,z -----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com <mailto:profoxtech-bounces@leafe.com>] On Behalf Of Rafael Copquin Sent: Thursday, 5 July 2018 5:30 AM To: profoxtech@leafe.com <mailto:profoxtech@leafe.com> Subject: recno() function in t-sql What is the equivalent of therecno() function in t-sql I need to fill a column called recnbr with the record number of each line In VFP it would be: update mytable set recnbr = recno() But since there is no recno() function in t-sql, what would be a replacement? TIA Rafael Copquin --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
[excessive quoting removed by server]
Learn to use the primary key. What you are doing can jam you up in an edit or delete. Just saying it is easier when you play by SS rules.
On Thu, Jul 5, 2018 at 7:14 AM Rafael Copquin rafael.copquin@gmail.com wrote:
Thank you
El mié., 4 de jul. de 2018 17:29, Darren foxdev@ozemail.com.au escribió:
Have a look at SELECT ROW_NUMBER() OVER(.....) AS Recnbr,x,y,z
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of
Rafael
Copquin Sent: Thursday, 5 July 2018 5:30 AM To: profoxtech@leafe.com Subject: recno() function in t-sql
What is the equivalent of therecno() function in t-sql
I need to fill a column called recnbr with the record number of each line
In VFP it would be:
update mytable set recnbr = recno()
But since there is no recno() function in t-sql, what would be a replacement?
TIA
Rafael Copquin
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]