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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Need help on query

Author  Topic 

kkm
Starting Member

15 Posts

Posted - 2008-08-14 : 10:14:28
I am selecting data from Inventory database for the assets based on the parameters( parameter1 , parameter2 )sent from dashboard application.
Here is the sample:
select * from Inventory_history
where dept= parameter1
serial_No=parameter2

What I want is Initially when the dahboard page loads I want to diplay the data for all departments and for all serial_No. Later when the user chooses specific dept and specific serail number then that specific row appears.

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-08-14 : 10:24:21
not sure exactly what code you're after but if it's just constructing the where clause you could use...

where (dept = @param1 or @param1 is null)
and (serial_no = @param2 or @param2 is null)

Em
Go to Top of Page

kkm
Starting Member

15 Posts

Posted - 2008-08-14 : 10:52:48
quote:
Originally posted by elancaster

not sure exactly what code you're after but if it's just constructing the where clause you could use...

where (dept = @param1 or @param1 is null)
and (serial_no = @param2 or @param2 is null)

Em


thank you for the response.

I am passing the name of dropdownbox as parameter like: ${dashboard.deptID};
It is java based dashboard application. Initially I want all the rows to be diplayed and later user chooses specific dept or serialnumber to display the specific row.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-15 : 01:44:37
the posted will provide you functionality requested. You need to make usre you passed NULL value to the code when user hasnt selected any dept/serialnumber value from application.
Go to Top of Page
   

- Advertisement -