How do I find a string after a query?
If you have a primary key, you can use this method on SQL Server 2005 and up:
SELECT
ROW_NUMBER() OVER (ORDER BY PrimaryKeyField) as RowNumber,
Field1,
Field2
FROM
YourSourceTable
If you don't have a primary key, you may need to duplicate the table into the mermory table (or a temporary table if it is very large) using the following method:
DECLARE @NewTable table (
RowNumber BIGINT IDENTITY(1,1) PRIMARY KEY,
Field1 varchar(50),
Field2 varchar(50),
)
INSERT INTO @NewTable
(Field1, Field2)
SELECT
Field1,
Field2
FROM
YourSourceTable
SELECT
RowNumber,
Field1,
Field2
FROM
@NewTable
The nice part of this is that you will be able to find duplicate rows if your original table does not have a primary key.
Also, at this point, I would suggest adding a primary key to each table if you don't already have one.
a source to share
I have a request and I need to find the line number that returns the request response. I don't have a counter box. how do i do it?
If I understand your question correctly, you have some kind of query that returns a string or multiple lines (answer, answers) and you want the number of lines to be associated with the answer
As you said, you don't have a counter field, so you need the following:
- select order criteria
- add counter
- run request
It will really help if you provide more details on your questions. If you confirm that I understood your question correctly, I will add a sample code
a source to share