Is There Is Any Direct Way To Set Optional Parameter

May 12, 2008



hi all,
I am using SQL reporting services 2005, i like to have a parameter as optional, is there is any diresct way to set a parameter as optional without setting through the default value.

View 6 Replies


ADVERTISEMENT

Optional Parameter

Apr 13, 2006

Hello,
Is it possible to define optional parameters for a stored procedure?
What I want is to create a search with about 8 parameters, but most users will only use 3 or 4, so It would be nice If I could only provide the used parameters in my code. And have sql give the unused parameters a default value (possibly %)
thx.

View 4 Replies View Related

SPROC With Optional Parameter

Jan 16, 2004

I need to use a parameter in a stored procedure that is optional and if it is optional I need all records returned, even if there is an entry in the field that the parameter is appllied to. Is this possible? I know I can assign a default value. but the value in the field could be one of many choices. I want to be able to specify a choice and have only those records returned or leave it blank and return all records.

Thanks for any help,

View 4 Replies View Related

Optional Parameter In Sql Query

Nov 6, 2005

Hi All,I have a stored proc which looks like this.Create ....(@id int,@ud int,@td int=0)if @td=0select bkah from asdf where id=@id and ud=@udelseselect bkah from asdf where id=@id and ud=@ud and td=@td---------------------------------I am wondering if i could replace if condition with the following lineselect bkah from asdf where id=@id and ud=@udand ( @td<>0 and td>@td )IS sql server 2000 smart enough not to use the td>@td in the query if@td is 0Thanks all

View 3 Replies View Related

SqlDataSource Optional Parameter Problem

Dec 5, 2005

Hi, I'm having some issues with the SqlDataSource. I want to use it
to
populate a GridView, but using an optional parameter to filter the
results.

This is what I have right now (hopefully haven't made any typos
- can't
copy/paste):

<asp:SqlDataSource ID="test1" runat="server"
SelectCommand="SELECT * FROM
SomeTable WHERE (@MyParam IS NULL OR MyColumn =
@MyParam) ORDER BY
SomeColumn" ConnectionString="<%
ConnectionStrings:MyConnString %>" >
<SelectParameters>
 
<asp:ControlParameter Name="MyParam"
ControlID="DropDownList1"
PropertyName="SelectedValue" Type="String"
ConvertEmptyStringToNull="True"
DefaultValue=""
/>
</SelectParameters>
</asp:SqlDataSource>

<asp:DropDownList
ID="DropDownList1" runat="server" AutoPostBack="True">
  <asp:ListItem
Selected="True" Value="">All</asp:ListItem>
 
<asp:ListItem>AnotherValue</asp:ListItem>
 
<asp:ListItem>SomeElse</asp:ListItem>
 
<asp:ListItem>Whatever</asp:ListItem>
</asp:DropDownList>

<asp:GridView
ID="GV" runat="server" DataSourceID="test1"
AutoGenerateColumns="False"
DataKeyNames="SomeID"
  <columns>
    <asp:BoundField
DataField="SomeColumn" HeaderText="A Title"
SortExpression="SomeColumn"
/>
   (more bound columns here...)
 
</columns>
</asp:GridView>

When I test the SQL query in
the query designer it works (returns only rows
having the value passed as a
parameter when one is specified, otherwise it
returns all rows), so it seems
like that part is OK. The "All" (as in
"return all"/no filtering) entry in
the DropDownList has a value of a zero
lenght string, and the
ControlParameter has the convert empty string to null
to true (and the
default value is the same), so it should get converted to a
null when "All"
is selected, hence returning all rows. But it doesn't work.
It works fine for
all the entries with text, but the zero lenght string
somehow doesn't work -
I get no results at all instead of it returning all
rows (but the query
itself worked fine when I tested it).

What am I missing? I just can't
find what I'm doing wrong. Any ideas/hints?
(I also need to do the same with
an ObjectDataSource, so hopefully I can get
this to work!) I can't think of
an easy way to find out if the zero lenght
string gets converted to a null or
not (I've even tried adding OR @MyParam =
'' to the query and it still didn't
work....) Right now I'm stuck....

(Also posted this question on microsoft.public.dotnet.framework.adonet newsgroup)

Thanks a lot in advance for the
replies!

Carl B.

View 1 Replies View Related

Can A Stored Procedure Parameter Be Optional

Mar 7, 2006

I want the procedure to check for the existence of a paramter and if it isthere, it will process these instructions, otherwise it will process theseinstructions. Any ideas? Thanks for your advice.Regards,CK

View 7 Replies View Related

Optional Command Line Parameter

Jan 17, 2006





Hello,



I want to use an optional parameter at the command line for my package.

I planned to make the first task a script which simply checks the variable (which is a string), and if it is empty, go one way, and if it is not, go another way. Is the best to go?



Many thnaks in advane

View 4 Replies View Related

Help With Optional Parameter Query With IN Statements

Aug 24, 2007

I have a query with 17 separate, optional, parameters. I have declared each parameter = NULL so that I can test for NULL in the case that the user didn€™t not pass in the parameter.

I am new enough to SQL Server that I am having difficulty building the WHERE clause with all of these optional parameters.

One solution I was advised on by a well paid SQL programmer, was to use a string in the stored proc and dynamically build the WHERE clause and exec it at the end of the sp. But the whole point of a stored proc is that it can be compiled and cached to make it faster, yet the string approach makes it have to compile every time it€™s run! Not a good solution, but maybe it€™s the best I can do . . .

I have tried many different approaches using different functions, etc. but I€™ve hit a brick wall. Any help in sorting it out with YOUR techniques would be greatly appreciated:

1. To add the parameter to the WHERE clause and test for NULL I€™ve used the COALESCE function such as €œWHERE table.fieldname = COALESCE(@Param, table.fieldname)€?. This works well if there is only one item in the parameter, but in the case that I pass multiple items to the parameter, it completely fails.

2. To handle multiple items, for example, if @Param = €˜3,7,98€™ (essentially, a csv separated list of keys)

Code SnippetWHERE table.fieldname IN(COALESCE(@Param, table.fieldname))


doesn€™t work because @Param needs to be parsed from a string into an array of integers in the parameter. So, I am using a UDF I discovered to parse the multi-item parameter. The UDF can be found at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsqlmag01/html/TreatYourself.asp and it returns a table variable that can be used in an IN statement. So I€™m using


Code SnippetISNULL(table.fieldname, 0) IN (SELECT value FROM dbo.fn_Split(@Param,€™,€™))



which works brilliantly in my WHERE statement AS LONG AS @Param ISN€™T NULL. So how do I test for NULL first and still use this approach to multi-item parameters?

I€™ve tried


Code SnippetWHERE @Param IS NULL OR ISNULL(table.fieldname, 0) IN (SELECT value FROM dbo.fn_Split(@Param,€™,€™))


and though it works, the OR causes it to slow way down as it compares every record for the OR. (It slows down by approximately 800%.) The other thing I tried was


Code SnippetISNULL (table.fieldname, 0) IN (CASE WHEN @Param IS NULL THEN ISNULL(table.fieldname, 0) ELSE (SELECT value FROM dbo.fn_Split(@Param,€™,€™)))



This fails with €œSubquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression€? due to the multiple values in the parameter. (I can€™t understand why the line without the CASE statement works, but the CASE line doesn€™t!)

Am I even on the right track, cuz this is driving me mad and I just need a way to deal with optional multi-item parameters in an IN statement? HELP!








View 4 Replies View Related

Optional Parameter On Joined Field Which Could Be Null?!

Jul 20, 2005

I have two tables: eg. a person-table (no nulls allowed), with an idand so on, and a person_course table (an intermediate table in amany-to many relationship between person table and courses tables),with two fields person_id and course_id.But I want to make ONE multipurpose stored procedure, which has ONLYoptional parameters on all fields in the person table AND the fieldcourse_id in the person_course table.I have no problems making optional parameters on the person table (eg.P.ID=ISNULL(@PersonID, P.ID ) ) BUT the problem is, when I try to addan optional parameter on the field course_id it dosn't produce theright results. Some times the course_id is null (because some personshavn't joined a class yet).Is there a way around it?Ole S. Pedersen

View 1 Replies View Related

Multivalued Report Parameter That Is Integer And Should Be Optional

May 23, 2007

Hello,

my problem is that i have a integer report parameter that must be multivalued. The parameter is populated by query. The thing is that in the beginning, there is no data in the dataset of the specific parameter. The table which is source to the dataset will br populated after some time from an XML.





Reporting services prompts the user to select a value for the parameter. But there is no value to select, yet. I cannot have leave blank because it is a string and not an int and i cannot have null because the parameter is multivalued. Any suggestions?





Thank you for your time and help!





/luskan

View 4 Replies View Related

Reporting Services :: Optional Parameter Usage In SSRS

Oct 15, 2015

In my report I have two parameters PID and patientName, but user want to enter either PID or patientName. When I preview the report user can only enter one parameter not both. Is there any way  to create two parameter available but users  can enter only one parameter value?Here is my report layout and query I used for that report. These two parameters comes from  one column 'String_NVC' as from query and column name 'Description' as from the report layout.

SELECT Username_NVC AS Username,
String_NVC,
Time_DT AS UserActionDateandTime,
FROM test

[code]...

View 8 Replies View Related

Reporting Services :: Check Box To Use As A Group By Parameter (Optional) In SSRS

May 13, 2015

I have a ssrs report with Name, phone ,state and city as columns. I have check box as one of my parameter(optional). If user checks that checkbox then it should group by state, if checkbox is left blank no need to do any grouping. How can i do this in ssrs 2012.

View 3 Replies View Related

Help With Direct Update

Aug 27, 2007

hi guys help please. I have a column name Quantity of type int in my table table1 and it has an intial value say 5. My question is, is it posible to update that column say, i want to add 10 from its initial value for it to have a value of 15, without querying it first from my application and store it to a varibale and add 10 to it for it to have 15 and execute update to set the initial to new value (15).

View 6 Replies View Related

Direct Interface To SQL Server

Dec 4, 2007

I did a little bit of looking in the forums for something like this, but I wasn't able to find anything.  In essence, I am looking to create a web form in ASP.NET which will emulate the SQL Server Query Analyzer Tool... eventually what I'd like to see:
- A dropdown of different connection strings, to connect to different databases
-A multi-line textbox where a user could type in a query (be it a SELECT, CREATE, UPDATE, or multiple queries at once)
-A gridview object for results
-A multiline textbox to contain server output ("the command completed successfully", "xxx rows returned", "syntax at line 3 not recognized", etc)
 I can do the first 3 without any difficulty, but I have absolutely no idea where to start with the server output.  Anyone have any ideas?  It does not need to be secure, as the only databases they'll have access to will be "test" databases and the pages will not be publicly hosted (LAN only)

View 2 Replies View Related

Direct SQL Vs Stored Procedures

Jan 3, 2008

Hi,

There are certian "routine things" that need to be queried in my database. Currently we can either do:

1) SELECT * FROM myTable WHERE id = x

OR

2) We can use a stored procedure to do the above SQL for us...That way, if the table changes, or we make changes to the database etc. The calling code will remain unchanged and we just have to change the stored procedure code instead of anywhere that calls it.

What would you say are any disadvantages of doing the 2nd approach?

Thanks!

View 14 Replies View Related

Prints Everything Big In Direct Printing

Apr 10, 2007


I am using SQL RS 2005 with VS2005 in Windows Application. I have placed Report Viewer on Windows From and then report is attached with it. Now report previews well in BIDS as well as in VS2005. Moreover it exports perfectly to pdf and excel but when I click print button on report viewer and give direct print to printer, font size, textbox, rectangle and every other thing become large, like instead of 10 font size, it prints 12, instead of 240 width of rectangle, it prints 280 or so.

There must be some solution to this thing. Some one help

View 3 Replies View Related

Direct Deployment Issues

Jul 24, 2007

Hi



I have found article by Jamie T. (www.sqlis.com/26.aspx) where he explains how to use direct configuration.

I followed every step.

Before building project I made sure that CreateDeploymentUtility = True.

Once project was built I have copied files from Deployment folder to other PC to c:PackageConfiguration (I have 3 files there: environment.dtsconfig, PersonAge.dtsx and jamie.SSISDeploymentManifest)

dtsConfig file is;



<?xml version="1.0" ?>

- <DTSConfiguration>


- <DTSConfigurationHeading>


<DTSConfigurationFileInfo GeneratedBy="me" GeneratedFromPackageName="PersonAge" GeneratedFromPackageID="{2612ABDA-E4FB-43DF-A1C1-44066426A798}" GeneratedDate="7/24/2007 9:46:41 AM" />
</DTSConfigurationHeading>

- <Configuration ConfiguredType="Property" Path="Package.Connections[Destination].Properties[InitialCatalog]" ValueType="String">


<ConfiguredValue>DataStore</ConfiguredValue>
</Configuration>

- <Configuration ConfiguredType="Property" Path="Package.Connections[Destination].Properties[ServerName]" ValueType="String">


<ConfiguredValue>MyPCsql2k5local</ConfiguredValue>
</Configuration>
</DTSConfiguration>

However, I am doing something wrong as I was not able to deploy this to another PC.

I double click Manifest file and in Configuration Package - Property there are two entries: InitailCatalog and ServerName. Initial Catalog has Value=DataStore and ServerName = MyPCsql2k5local. I change ServerName to be AlexPcSQL2k5Local.

I have Validate Package after instalation so I get error saying that connection to Destination failed.

If I go to File System to installed package and say Run, package will run OK if I change all ConnectionManagers to point to AlexPcSQL2k5Local

What is it that I am doing wrong?

View 7 Replies View Related

Direct Link To Reports

Jul 12, 2007

Hi There,



I have recently upgraded to report Server 2005. I used to have a webpage that loaded a number of reports into different frames to give real time statistics for an IT Service Desk.



In the new version if try and link directly to the report (By right clicking a report and taking the link) the report loads with out any of the toolbars etc at the top as i need it, however it does not refresh and seem to be cached data.



Has anyone got any ideas how to resolve this problem, in short all I need is a way to directly view the report losing all the toolbars etc on the top and just displaying the data.



This has been driving me mad so if anyone could help i would be really grateful!



Many thanks



Gerard

View 1 Replies View Related

Direct Display Of SQL Image Field

Aug 3, 2004

Hi

I have a SQL 2000 table in which pictures are stored as an Image column. I want to display then onto a c# aspx webpage without storing them to disk.
What is the best way to read and display the pictures?
In classic ASP I used to do this:
Response.ContentType = "image/jpeg"
Response.BinaryWrite rs.fields("ThisImage")
but I can't get this to work in c#.

View 2 Replies View Related

Anyone Direct Me To Good JOIN Tutorials..

Oct 8, 2007

ok i need to know the difference between inner outer , left , right joins ....

anyone know any good tutorials ?

View 3 Replies View Related

Differences Between Variable And Value Direct In A SELECT

Dec 11, 2007

I have a table from 1.5 million records.
A valued-table function with the parameters used in a SELECT.

1) If I use:
DECLARE @Par1 int
SET @Par1 = 28338;
SELECT Count (*) FROM MyTableValuedFunction (@Par1)
Running time: 2.3 min.

2) If instead:
SELECT Count (*) FROM MyTableValuedFunction (28338)
Running time: 0.02 sec.

Why?

The two solutions are not identical?

View 5 Replies View Related

Direct Vs. Indirect Package Configurations

Sep 29, 2006

If your XML configuration files will be in the same location on your Development, UAT and PROD servers, is there any merit to making your configurations indirect?

I am modifying the connection string with the XML. My strategy is to set up an XML configuration for each database that we have. The Dev XML config will point to Development connection, UAT to UAT etc..

My thought is that by using the direct configuration it will eliminate the need for environment variables and also allow me to add configs without having to reboot the servers, which you would need to do in order to get server to recongize the EV.



Thanks

View 5 Replies View Related

Replication And Direct Updating In SQL 2000

May 3, 2006

I have taken over the support over a database in sql 2000 that has 10+ remote users that synchronise each day. However it also has 30+ users who are directly updating the data in the live database on the server.

One of these users is entering data directly upon the database on the server but the new rows are being placed in the conflict table somehow!!

Does anybody have any ideas about how this could be happening ?

Is it ok to have users directly updating on the server and users synchronising ?

I would appreciate any help!!

Thanks.

View 1 Replies View Related

Trusted Connections && Preventing Direct Db Access

Aug 29, 2007

Is there a way to use trusted connections in ASP.NET and WinForm applications yet prevent users from accessing databases directly (outside of applications) ?  I know the use of trusted connections are recommended for several reasons however I have a lot of applications that I need to prevent users from accessing databases directly outside of the applications themselves.

View 5 Replies View Related

Shortcuts, Direct Keys In Management Studio ?

Dec 8, 2007

 Hello. Does anybody knows if the are shortcuts to differrent menu items in Sql 2005 Management Studio ?For example i will to use the "Execute " button without need to use the mouse, as this case as of others.Any knows where can i find a map or a page info with the shortcuts of SQL2005 Management Studio ? Thanks 

View 1 Replies View Related

Direct Connection To Local SQL Express Gives Error

May 17, 2006

I'm just starting out here.
I created a simple formview connected to a local file copy of the database by adding the database into the project.  It worked fine.
However, I noticed that this copy of the database was not synch'ing with the database with the same name in SQL express.  So I created a new connections string to access the SQL database directly out of SQL express.  Its just a simple Select * from column.  However, this gives an error.  Why?
Server Error in '/NETCatMgr' Application.


The data types ntext and nvarchar are incompatible in the equal to operator.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: The data types ntext and nvarchar are incompatible in the equal to operator.
 
This is the connection string
<add name="CatalogMgrConnectionString" connectionString="Data Source=mymachinesqlexpress;Initial Catalog=CatalogSQL;Integrated Security=True"
providerName="System.Data.SqlClient" />
 
Doesn't make sense.  How can the formview work fine with the SQL integrated into the project but not working with a connection string to the SQL Express proper???

View 2 Replies View Related

How To Direct Query Result To A Text File

Aug 17, 2001

In SQL7 Query Analyzer we want the results of a SELECT statement not to be displayed on screen but written to a text file.

We assume that in the tons of sp_ and SET statements there should exist
one where output file can be defined.

Greetings from Mannheim, Germany
Ricardo

View 1 Replies View Related

2005 - Direct Modifications To Systems Catalogs

Jul 20, 2007

In 2000 there was a server level setting you could change in EM, to allow direct modifications to systems catalogs.

in 2005 I would like to update some sids in sysusers tables, do I also need to find and set this option first

View 6 Replies View Related

SQL 2012 :: Profiler - Trace Direct Queries Only?

Oct 21, 2015

Is there a way to setup a trace to show only direct TSQL statements triggered on my server? note I don't want to capture Procedure calls or the statements called within the procs.

Actually many people are firing direct SQL statements on server. And some are coming from entity framework as well. I just want to capture those.

View 1 Replies View Related

Seek Method, Table-direct, And Sql Server2005

Jul 23, 2005

From what I've read in the docs, ado.net currently supports opening sqlserver ce tables in table-direct mode and performing Seek operations on them(using SqlCeDataReader), but not on the full-blown sql server. Is this(will this be) still true with ado.net 2.0 & sql server 2005?

View 11 Replies View Related

There Is No Direct Equivalent To Oracle's Rownum Or Row Id In SQL Server

Sep 23, 2006

hi,

There is no direct equivalent to Oracle's rownum or row id in SQL Server

there is any possiblity are alternate thing is exist then please reply



regards

santosh

View 10 Replies View Related

XML Direct Configuration Files For SSIS Packages

Nov 16, 2006

Hello,

I need some clarification. I am trying to utilize the XML Direct Configuration in my SSIS packages to utilize database connections in the package. I am wanting to utilize this the same way you could use UDLs in the SQL Server 2000 DTS packages.

Currently, I am creating the dtsConfig file and saving it to my desktop. I then modify it with notepad and add the following configuration where it looks like this:

<DTSConfiguration>

<Configuration ConfiguredType="Property" Path="Package.Connections[ConnectionName].Properties[ConnectionString]" ValueType="String">




<ConfiguredValue>Data Source=[ServerName];Initial Catalog=[DBName];Provider=SQLNCLI.1;Integrated Security=SSPI;Auto Translate=False;</ConfiguredValue>
</Configuration>
</DTSConfiguration>

Once this is created, I am trying to "re-use" this in SSIS packages created moving forward, where they all point to this configuration for the same database connection.

What I don't understand is when "Enabling Package Configuration" and then pointing to this dtsConfig file doesn't create a connection in "Connection Manager" NOR does it provide a way to create a blank connection and point to this configuration.

I feel like I am missing something thats so "great" about XML configuration files. Any help would be appreciated.

Thanks,

Daniel Lackey
MCSD

View 3 Replies View Related

Possible To Render Direct To PDF Instead Of Viewing The Report On A Webpage?

May 16, 2007

Is it possible to to render direct to PDF when viewing the report url?

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved