Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to find a row id of selected column fields.

Author  Topic 

NagaVardhanReddy
Starting Member

4 Posts

Posted - 2012-02-08 : 08:24:56
Hi Friends,

I want to know how to get row id of the table, by giving the column names, and values.

Here the query has to check the column values, and the unique row number should be the return value.

Can any one help me how to write a query for that.


Regards,

Naga Vardhan Reddy

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-02-08 : 08:27:53
select id from table where column = 'theValue'


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

NagaVardhanReddy
Starting Member

4 Posts

Posted - 2012-02-08 : 08:35:47
I am getting the following error,

sqlite> select id from ONTTable where slotId=1;
Error: no such column: id


Regards,


Naga Vardhan Reddy
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-02-08 : 08:38:16
Sorry but I don't know the name of the column that have named as "row id" in your first post.
Do you know the column name?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

NagaVardhanReddy
Starting Member

4 Posts

Posted - 2012-02-08 : 08:44:58
I have a 'C' Function, to that function i am getting "Data Base Name", "Table Name", "Number of Columns", "Column Names", and "Column Values".


Now i have to frame a sql query with all the above data and need to find out which row having the values, which match the column values as i got.

And the query return that particular row id. With that row id, i will extract all the values present in that row.

That's what i want to do.

Can you help me how to do this.

Regards,

Naga Vardhan Reddy
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-02-08 : 08:49:40
see here please:
http://www.sqlite.org/autoinc.html


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -