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

 All Forums
 Old Forums
 CLOSED - General SQL Server
 Select Row contains values as 1

Author  Topic 

Posting Yak Master

242 Posts

Posted - 2006-08-28 : 07:59:08
Hi team,
I want to select a particular row where any fields name contains the value as 1.How can I.I am using vb as Front End and SQL server as back end.

Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-08-28 : 08:08:06
Somthing like this
Select * from TableName Where
Field1 = 1 or Field2= 1 or...

Go to Top of Page

Posting Yak Master

242 Posts

Posted - 2006-08-28 : 08:12:08
Dear chiragkhabaria,
Thanks for your reply.The table has more that 25 columns.So i need some general Module.Any field can have a value as 1.But I need to select the value of any of the fieldss.
Go to Top of Page

Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-08-28 : 08:14:42
Like this?
SELECT	Field1 f
FROM TableName
WHERE Field1 = 1
SELECT Field2 f
FROM TableName
WHERE Field2 = 1
SELECT Field3 f
FROM TableName
WHERE Field3 = 1

Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Premature Yak Congratulator

22864 Posts

Posted - 2006-08-28 : 10:01:31
Why do you have this requirement?
Is the table normalised?


Failing to plan is Planning to fail
Go to Top of Page

- Advertisement -