.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Can a single Parameter be used for multiple columns in the query.

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :Sql Server

Hi all,

I was trying to create a report with a slight different kind of requirement,

Actually I have 5 Columns in a table from which I want the user to be capable to view the data based on any combination for those columns.

For Example:

I have a table Employee with attributes: Name / Age / Salary / STATE

Now I want the user to be capable of selecting any combination for these columns and then running the report, Actually the report will behave like a Select Query with Where clause with AND conditions for all columns.

Report design should be like this:

FIRST prompt:   Select Column name  ex: AGE

SECOND prompt:   Select Column Value ex: 30

(now store this value somewhere and allow the user to again select a different column name like STATE, and the SECOND prompt will show all distinct STATEvalues, then user selects for ex: NEW YORK

Then when USER clicks VIEW REPORT:

Show all the employees where AGE = 30 and STATE = NEW YORK.

Is it possible ? as I dont want to create 10 prompts for 5 columns separately.

Any help is appreciated.



View Complete Post

More Related Resource Links

Running a single SQL update query on multiple foxpro databases

Hi, Env : SSIS 2008 My requirement is to run a update SQL statement on multiple foxpro databases. The fox database paths are available in a SQL server table.  I've created a for each loop control and assigned the database path to a variable named dbpath. Within the loop, I added an "execute sql task" control. Now what properties are to be set to get the requirement done. Appreciate any help. Regards. BH  Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful. BH


the database result is as follows DATE     code   class1 class2  class3 1/8/10     M1     10       20     30     3/8/10     V2      20       30     10      1/8/10      H1      1           2      3         7/8/10     ! ! 8/8/10     !M2    5      5      5       3/8/10     B2      4      4     4       1/8/10     V1      3      7     3       THE OUTPUT SHOULD BE AS FOLLOWS:- DATE           M1                          M2           

Inserting multiple records under the single query

Hi All,       I have to insert a multiple records under the single table.So i have to execute the command in the frontend for every records. Inorder to avoid i write the query like this   insert into table1(field1,field2) values('1','Test1'),('2','Test2'); and also i tried insert into table1(field1,field2) SELECT "1","Test1" Union all SELECT "2","Test2" But I am getting syntax error. How to insert a multiple records under the single query???...

Any way to pass Multiple Values for a single Label in the Parameter?

  I have a Report that Contains 2 Parameters, @Customer & @Area. When trying to set up the Available Values for @Area, I'm having issues using multiple values for one Label, i.e. = "4006" Or "4610" One of the Filters in the Report is an Operation number, which is the [OPERATION] field, which is setup as a filter on the Tablix referencing the @Area parameter.  PROBLEM: I cannot retrieve any data when trying to use the ‘Or’ Operator here. If I simply put “4006” or “4610” I retrieve data, but when trying to combine it returns no data. Example, I need to allow a user to select ‘Chassis Incoming’, which would include data from Operations 4006 & 4610. QUESTION: Any way to pass Multiple Values for a single Label in the Parameter? I realize the typical solution may be to use ‘Multi-Value’ selection, but in this case we want the User to select the Area and the multiple values for Filtering will be automatically determined for them. Otherwise, they are subject to not getting it correct. I have tried several different ways, such as =”4006” Or “4610”, =(“4006”, “4610”), = In(“4006”, “4610”), etc….   Note: We are using Report Builder 3.0  

It is possible to alter multiple columns within a single alter table statement?


It is possible to alter multiple columns within a single alter table statement?

I tried & searched not getting it.

Alter table au_de alter column m_user char(9),c_user char(9)

Msg 102, Level 15, State 1, Line 1

Incorrect syntax near ','.


Alter table au_de alter column m_user char(9),alter column c_user char(9)
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ','.

sql passing multiple value in single parameter


Hi all ,

I have a stored procedure with one parameter @reportname where i am suppose to pass report name to diplay data ,but i want this parameter to accept multiple value n.means if i give multiple reportname then it should get insert in my table ..i am writing the script..below..



procedure [dbo].[abc11](@ReportName nvarchar(500

Create multiple XML files from a single query



I'm using this code for creating and xml file out of a SQL2005 table:

select (select 
    from ProductsInfo_ZAP p
    for xml path('PRODUCT'),TYPE, ROOT('PRODUCTS')
) for xml path(''), ROOT('STORE')

Is there a way for me to create multiple xml files, one for every row, going by the primary key column, or do I have to create a separate query for each row?

I would also wondering what is the syntax for transforming this query into a stored procedure


SQL 'FOR XML' query - multiple blocks within single block


Hello All

I am trying to write a SQL 'FOR XML' query that produces an XML block in a specific xml format.  The query I have so far is close but I am having problems getting it produce the exact xml format that I need.  I hoping someone on here can help me.

Using the following SQL, I populate the table against which, the SQL FOR XML query is run:


 F_id   INT  NOT NULL,
 B_id   INT  NOT NULL,
 Name   VARCHAR(500) NOT NULL,


insert Bmk (F_id,B_id,Name,Start_date,End_date)
values (128,332, 'Item1','2000-07-01T00:00:00', '2079-01-01T00:00:00')

insert Bmk (F_id,B_id,Name,Start_date,End_date)
values (128,333, 'Item2','2000-07-02T00:00:00', '2079-01-01T00:00:00')

insert Bmk (F_id,B_id,Name,Start_date,End_date)
values (130,334, 'Item3','2000-07-03T00:00:00', '2079-01-01T00:00:00')

insert Bmk (F_id,B_id,Name,Start_date,End_date)
values (138,342, 'Item4','2000-07-04T00:00:00', '2079-01-01T00:00:00')




Then I run the following query:

  F_id as  'F_id',

Display multiple Columns in Single Column in SQL CE 3.5


I have table with different columns

Ex. Device table

Columns : deviceid,devicetype,device1,device2,device3,device4

                    1  Swich board         D1      D2        D3       D4

                    2  Sensors              S1      S2         S3       S4

i want to display this  table contains in single row

Device Name








Please Help me


Thanks in advance



MS SQL Server: Search All Tables, Columns & Rows For Data or Keyword Query

If you need to search your entire database for specific data, this query will come in handy.

So when a client needs a custom report or some sort of custom development using Great Plains, most of the time I will have to track down the data in the system by running this query and find the table(s) it is in.

Adding Multiple Columns and Rows in GridView without using a Database

This article describes on how to add multiple columns and rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in each TextBoxes on Button Click and retain the GridView data on post back.

merging multiple tables in a single dataset to single table


 i have a stored procedure which returns three tables to a dataset ..... now i need to merge all three tables to a single table from d same dataset 

like dataset1 has table1 table2 and table3 .... i want all the three tabels to be merged into dataset1 itself .... instead of three diffrent tables so that i can show all three table data in a single datagrid  as a compact data and combination of 3 tables from d single dataset.....

can some1 help me please.....

MDX Query parameter from SSRS


I've a MDX Query that has where clause as shown below.
I'm designing report using SSRS 2008. How can i pass date as parameter ? I tried to setup @from and @to as parameter but not working ?
any ideas....

WHERE ( {[Date Central].[Calendar Date].[2010-04-01 00:00:00]:[Date Central].[Calendar Date].[2010-08-30 00:00:00]} )

need it to work as
WHERE ( {[Date Central].[Calendar Date].[@From]:[Date Central].[Calendar Date].[@To]} )



Get ServerReport selected Parameter value to use in vb query


I'm using ReportViewer in Asp.net 2.0 to view a SSRS report. I need the value of the selected parameter to use in a vb query. The parameters are populated on the server and its a single selection. Doing searches I've come across  ReportViewer1.ServerReport.GetParameters() but I can't figure out if I can use this to determine which value the user has selected in the parameter dropdownlist. Any help would be appreciated.

how to set multiple button in single image


Hi friends,

I need to make multiple button in a single image in asp.net.

and need coding also for vb.net.

thanx in advance

How To Remove a Query Parameter from a URL


for a string such as this:


how would I remove the parameter id 12?


single form multiple buttons in MVC


In a single page  has two buttons , ddown and tempname.

I wrote two actionresult separetly each one for ddown and tempname.

I need one is post and another one is get method. so i gave like

1. Get Method


        [AcceptParameter(Name = "button", Value = "tempname")]
        public ActionResult ddown_tempname(string statusName, NewsLetterAdminViewModel viewModel)

return View();



2.Post Method


        [AcceptParameter(Name = "button", Value = "ddown")]
        public ActionResult ddown(string statusName, string button, NewsLetterAdminViewModel viewModel, FormCollection collection)

return View();



if i call the post method its worked well. but if i call the get method, the code does not execute. the brea

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend