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
ADVERTISEMENT
Jul 2, 2015
I'm building a report and I want to have a parameter that has multiple integer values (not text).I can get it to work just fine if I create a value for each and every numeric value, but I want the user to only see two choices in the dropdown menu (plus the "Select All" that gets automatically created when I tick the box for "Allow multiple values"). How can I make this work?
For example, for my TYPE parameter I'd like something like this:
Label: Tigers
Value: 2
Label: Lions Bears Oh My
Value: 1,3,4,5,6
But I can't seem to set a multiple Value for an integer. And I can't seem to wrap the value with quotes and use Text as the Data Type because it says an error occured during processing (I assume because the field I'm going against is of the Integer format).My query would look something like this (the real one is a lot more complex):
SELECT
v_R_System.Netbios_Name0
,v_GS_COMPUTER_SYSTEM_EXT.PCSystemType0
FROM
v_R_System
INNER JOIN v_GS_COMPUTER_SYSTEM_EXT
ON v_R_System.ResourceID = v_GS_COMPUTER_SYSTEM_EXT.ResourceID
WHERE
v_GS_COMPUTER_SYSTEM_EXT.PCSystemType0 IN (@TYPE)
I've tried different Expressions, filters, options, syntax, and what-not, but I think I'm missing something basic.
View 2 Replies
View Related
Jun 22, 2007
Hello everyone
I have a multivalued parameter called param_state
I am trying to output the values off what is selected to a textbox so the user can see what was selected
I have entered the following expression in a text box
= "Sales rep for " & Parameters!Param_State.Value
I get an error for this and if I enter it as
= "Sales rep for " & Parameters!Param_State.Value(0)
I get only the first state.
Is there a way to show what was selected ?
thanks
View 3 Replies
View Related
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
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
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
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
View Related
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
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
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
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
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
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
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
Jun 11, 2007
Is there a way to create optional parameters in Reporting. For example, I have two tables Region and Country, with drop downs in report displaying the list of each. The stored proc for Country list expects an input parameter RegionID but does NOT require one for the result set to be fetched. The stored procs run fine in sql, but when run with the report, the designer always complains that the RegionID Parameter must be provided for the Country DataSet/List to be populated. Is there a way to create this RegionID parameter as optional such that the country list is populated with all rows in the Country table if no RegionId is provided, and filters if a RegionId is provided??
here is some code that I am using my stored procs
Code Snippet
For Regions
SP1
Create Proc... spGetRegions
Begin...
Select RegionID, RegionName From Region
Order By RegionName
End
Code Snippet
For Countries
SP2
Create Procedure dbo.spGetCountries
@RegionID int = NULL,
AS
Begin
Select CountryID, CountryName From Country C
WHERE C.RegionID = CASE WHEN @RegionID is null THEN C.RegionID ELSE
@RegionID END
ORDER BY C.CountryName
END
View 7 Replies
View Related
Nov 30, 2006
Hi,
Is it possible to create optional parameters in Report Builder?
An *ordinary* parameter is created by marking a filter expression as "prompted". At run-time, the user will be asked to provide a value for this parameter (or accept a default value if it is available). This works fine. What I want is to let the user choose whether to provide a value, or leave the parameter empty. In latter case, the reports should not take the parameter into account and display all available data.
Example: I have a list of products grouped by the name of the supplier. I want users to be able to see the entire list, or narrow it down to one supplier only. So I create a free text parameter that will contain a part of the supplier's name. It works ok, but if parameter is left blank, or set to NULL, the report will display no data (all products always have their suppliers).
I tried to create a filter formula to check for empty value and bypass the filter if necessary, but the formula only allows me to use the parameter expression once. So I cannot check for empty value and apply the filter in the same expression.
As a last resort, I used the following workaround: created a new formula named "Enter 'ALL' to see all suppliers" that would return text constant "ALL". I then added another prompted filter expression for this field and grouped it with my supplier prompt using "Any of" group. User is now able to choose a supplier, or enter "ALL" to the second prompt field. This clumsy approach actually works, but then another problem emerges - although I mark both filter fields as Prompted, the Report Builder will forget this flag for one of the fields when the report is reopened. I think it could be a bug (we use SQL2005 SP1)
Anyway, it'd be nice if I could create an optional parameter as one expression, not two. Is there any way to do that?
TIA
Denis
View 34 Replies
View Related
Jan 29, 2008
I have cascading parameters in my report, and the vast majority of the fields on which the parameters are
based are varchar fields. In each of the drop-down menus on the report, I would like to have an option
at the top of the list called <All> which allows the user to select all of the possible values.
I have done this successfully for all the varchar fields, but there is one parameter which is based on an
integer. This obviously means it won't accept the value <All>. So, as a temporary workaround I have
created an option called -1, which when selected by the user, selects all the possible values in the
list. However, this is likely to be confusing for users if they don't realise that the -1 option means
"all". Is there any way I can make the -1 actually appear in the list as <All>? How would I go about
this?
The available values for the parameters come from an underlying dataset query.
View 1 Replies
View Related
Jul 3, 2007
Hi have a problem to solve and I hope that this is not a SSRS Bug.
I created a Reports(using SQL Server Project) which has several parameters which values are passed to a SP.
One of these parameter is an Integer and it is an optional value, so if the user fill it is used by the SP, otherwise the SP uses NULL and run anyway.
I starts to define tha parameter:
Datatype = integer
Allow blank value
Available: Non queried
Default: Null
if I want to Preview the report I have to provide an integer to the parameter's field ...
If for instance I set:
Default: Not queried = 0
In the moment I deploy and I use the ReportViewer in my window application the parameter's field is unabled!!
So I tried this solution:
Datatype = integer
Allow blank value
Allow null value
Available: Non queried
Default: Null
In the preview the checkbox: NULL is checked and I click on the View Report.
But when I deploy it,in the ReportViewer in my window application the parameter's field this checkbox is unchecked.
Do I forget something during my setting??I have to control it programmatically??
N.B. By default the user will not user this parameter so the best is that he can click directly on "View Report" without any additional "work" on the parameter!!
Thank you for any help!
View 1 Replies
View Related
May 11, 2007
Hey guys I have the following in my SQL statement:
DATEADD(hh, @hours, @startTime)
hours is an integer and startTime is actually a string, but the thing is that this statement works fine if I use it like this:
DATEADD(hh, 8, @startTime)
The first version is what I need so that the user can control from a parameter and I get the following error:
Error Source: System.Data
Error Message: Failed to convert parameter value from a Decimal to a DateTime.
Thanks!
BJ
View 2 Replies
View Related
Jul 11, 2007
I am trying to create a report with a multi value integer parameter. I have tried
="SELECT * FROM vProjectRequestStatus WHERE ProjectRequestStatusCode IN (" + Parameters!StatusCode.Value + ")"
I get an error stating
An error occurred during local report processing.
An error has occurred during report processing.
Cannot set the command text for data set 'ProjectRequestStatus'.
Error during processing of the CommandText expression of dataset 'ProjectRequestStatus'.
Has anybody worked with integers?
Thanks,
Fred
View 8 Replies
View Related
Jul 5, 2007
Please i have lots of reports, i would like to pass parameters, i may pass or i will not pass.
but all of my reports are using stored procs from sql server database.
please guys can some one give me an idea how can i have optional parameters defined in the stored procedure.
in the reports layout collections property where i have to specify the parameters need to run the report there how can i define. wether it is optional of required parameter.
i see the parameters collections object there are hidden, pass null or pass a default value or pass the info via query etc.
please help thank you very much for the information.
View 1 Replies
View Related
Mar 14, 2007
Hi All,
Is there any way to make Multivalue parameter ( list parameter) in Report builder as optional ?
I was able to achieve optional functionalitiy for parameter is single value but not able to with respect to multivalue parameters
An early response is highly appreciated
Thanks
View 4 Replies
View Related
Jun 3, 2008
I'm trying to build an SQL string that should look like this when executed:
UPDATE [Table] SET Active = 'False' WHERE ID IN (3, 4, 5, 6, 7, etc.)
I'm using the convention (in code behind):SqlCommand cmd = new SqlCommand("UPDATE [Table] SET Active = 'False' WHERE ID IN (@TheIDs)", connection);cmd.Parameters.Add("TheIDs", SqlDbType.Text).Value = theIDsAsAnArrayList;
But logically enough I cannot insert them as a text string as they have to be integers seperated by commas.
Question: How can I convert an Array of integers into ... well, a string without the quotes, if you know what I mean?
As it cannot end up like this: UPDATE [Table] SET Active = 'False' WHERE ID IN ("3, 4, 5, 6, 7, etc.")
Note the quotes around the integers.
Any hints on doing this with security in mind are welcome. I know I can concatenate the whole lot as strings, but this is unsecure, so I'm not going for that approach.
View 4 Replies
View Related
Apr 14, 2014
I need to extract the integer part of the string that exists on the right side of the string
So e.g.
I have BASIC56 then I only want 56 and if I have BASIC6 then I only want 6 and BASIC100 then I want 100 to be extracted out in sql.
Is it possible to do that?
View 3 Replies
View Related
Dec 14, 2006
I want to convert a string into an interger so that my parameter can get one value, and have a seperate matrix list the value before the value selected.
My parameter is year. The user picks the year. And i want the crashcounts for the year displayed in the matrix. Then i have another matrix with a dataset similiar. I want this seperate Matrix/Dataset to display the previous year.
SO if the user selects 2004 from the dropdown. 2004 is displayed in the first matrix, and 2003 is displayed in the second matrix. The year attribute is in string format, and i cant change it in the cube. So i was told it could be converted in reporting services. with this
=CStr(CInt(Parameters!CrashStatisticalYear.Value)-1)
Question is, where do i put this...and how come when i put it in the parameters expression for the 2nd matrix, i get an error datatype messege? HELP !
View 2 Replies
View Related
May 11, 2007
Just to be clear i'm using a cube here.
Okay if i understand correct if you want to sort your parameter list you have to write an MDX query.
Thats all good and well i've been able to sort my parameter list when its a string
WITH
MEMBER [Measures].[ParameterCaption] AS '[Time].[Week].CURRENTMEMBER.MEMBER_CAPTION'
MEMBER [Measures].[ParameterValue] AS '[Time].[Week].CURRENTMEMBER.UNIQUENAME'
MEMBER [Measures].[ParameterLevel] AS '[Time].[Week].CURRENTMEMBER.LEVEL.ORDINAL'
MEMBER [Measures].[DefaultValue] AS '[Time].[Week].CURRENTMEMBER.UNIQUENAME'
MEMBER [Measures].[DefaultBeginValue] AS ' ( "[Time].[Week].&[" + LEFT([Time].[Week].CURRENTMEMBER.MEMBER_CAPTION,4) + "-01]" ) '
SELECT {
[Measures].[ParameterCaption],
[Measures].[ParameterValue],
[Measures].[ParameterLevel],
[Measures].[DefaultValue],
[Measures].[DefaultBeginValue]
}
ON COLUMNS
, {
Filter ((ORDER({(Filter ([Time].[Week].MEMBERS,( [Time].[Week].CURRENTMEMBER.MEMBER_CAPTION ) <> 'Unknown'))},
([Time].[Week].CURRENTMEMBER.UNIQUENAME) , DESC)),
( [Time].[Week].CURRENTMEMBER.LEVEL.ORDINAL ) = 1)
}
ON ROWS FROM [Europe]
Now my problem is that this value of this string is actually an integer. The reason this is a data type string is because its a dimension and these are always string only measures are integer...
Can someone help me make this MDX query sort on integer value instead of string.
[Time].[Week].MEMBERS contains values like 8,11,20 but is declared are string because its a dimension please help me out because i'm getting the feeling this is impossible with this microsoft tool...
View 1 Replies
View Related
Jan 12, 2008
I have the following stored procedure:
Code Block
CREATE PROCEDURE udsp_td_queryowner
@state varchar(10) = NULL,
@businesstype varchar(20) = NULL,
@size int = NULL,
@sortorder varchar(20) = 'state'
AS
SELECT gl_t.state AS [State],
gl_t.business_type AS [Business Type],
gl_t.lowsize AS [Low Size],
gl_t.highsize AS [High Size],
e.InternetAddress AS [Owner]
FROM gl_territory gl_t JOIN employee e ON gl_t.employeenumber = e.EmployeeNumber
WHERE state = COALESCE(@state, state) AND
business_type = COALESCE(@businesstype, business_type) AND
COALESCE(@size, lowsize, highsize) between lowsize AND highsize
ORDER BY CASE WHEN @sortorder = 'state' THEN gl_t.state
WHEN @sortorder = 'business type' THEN gl_t.business_type
WHEN @sortorder = 'owner' THEN RTRIM(e.FirstName) + ' ' + RTRIM(e.LastName)
END ASC,
CASE WHEN @sortorder = 'low size' THEN gl_t.lowsize
WHEN @sortorder = 'high size' THEN gl_t.highsize
END ASC,
CASE WHEN @sortorder = 'statedesc' THEN gl_t.state
WHEN @sortorder = 'business typedesc' THEN gl_t.business_type
WHEN @sortorder = 'ownerdesc' THEN RTRIM(e.FirstName) + ' ' + RTRIM(e.LastName)
END DESC,
CASE WHEN @sortorder = 'low sizedesc' THEN gl_t.lowsize
WHEN @sortorder = 'high sizedesc' THEN gl_t.highsize
END DESC
What it allows me to do is enter in any number of the variables when running the stored procedure. For example, EXECUTE udsp_td_queryowner @state = 'IA' would give me everything in the table in the state of IA regardless of the other field values. Likewise, if I ran EXECUTE udsp_td_queryowner @state = 'KY', @size = 15 it would return the records that are in KY and the size of 15 is in the range of the low and high value.
If I run the first example in Query Analyzer I get 53 records from the data I have. It returns every record that has IA as the state. I run the same thing in Reporting Services and all I get is 3 records. Just the 3 records for the state of IA where the business type is either null or blank (I can't tell.) If I allow all of the variables to accept Nulls then it returns the correct data. However, I would like to find a better alternative because when the report is run it returns all of the records in the table initially and if they user wants to enter in any parameters they have to toggle off the null box for the corresponding paramter.
Any ideas?
View 12 Replies
View Related
May 9, 2008
I was comparing the parameters for two stored procs that I made using the SQL Server 2005 express management studio. Both of these sprocs only inserted one field into a single table. These were both of the type varchar.
One of the sprocs had "nocount on" and the other did not. I thought I would see the returns integer parameter in the sproc that did not have "nocount" set to on. I thought this is what returns an integer to validate an insert. Obviously, I am confused about how this works.
Can anyone help me to understand that difference between nocount on and the parameter that returns an integer.
Any help is appreciated.
View 1 Replies
View Related
Apr 21, 2008
Is it possible to include a text/string as suffix(append to the end of textbox) to an report parameter prompt string ? Something like this
Enter Date: [ Textbox ] format:mm/dd/yyyy
Enter Age:[Textbox ] e.g 50
I need to include text like the one that I have highlighted in blue. Could someone help me out?
View 7 Replies
View Related
Jan 19, 2007
I've got a function which inserts into a database, and has arguments for each item being inserted
A couple of the items are integer datatypes (in SQL), but they will accept nulls
When I add my parameters, it asks to explicitly use the SQL datatype (which is integer):.Add("@myParam", SqlDbType.Int).Value = myParam
In the header of the function, I assumed I could make the argument optional - Optional ByVal myParam as Integer=System.DBNull.Value
However, when the function runs, I always get an error:System.InvalidCastException was unhandled by user code Message="Conversion from type 'DBNull' to type 'Integer' is not valid."
I make them all Optional (which won't happen, but various arguments may be, at different timesand I get this error, with the last item (which is on a separate line), in red:Constant expression is required.
How can I get around this?
View 3 Replies
View Related
Sep 17, 2007
I'm having problem on trying to execute a query in stored procedure that has parameters as a integer. The parameter with the integer is in the WHERE clause. If I take out the WHERE clause, it would work. If I take out the parameter and replace it with a value, it would work. I have try using the CONVERT function to convert it to an integer, still no luck.
Error: Unterminated String Constant.
What is the problem?
Set @strSQL='Select * From(SELECT Row_Number() Over(Order By ' + @SortExpression + ') as Row_Count,Rank() Over (Order By ' + @SortExpression + ') as TableInfo_ColumnSort,dbo.EVENT_LOGS.EVENTLOG_ID, dbo.USERS.USERNAME, dbo.EVENT_LOGS.ITEM_TYPE, dbo.EVENT_LOGS.SCREEN_ID, dbo.EVENT_LOGS.CHANGE_TYPE, dbo.EVENT_LOGS.IP_ADDRESS, dbo.EVENT_LOGS.CREATE_DATE,dbo.USERS.FIRST_NAME,dbo.USERS.Last_NAMEFROM dbo.EVENT_LOGS INNER JOINdbo.USERS ON dbo.EVENT_LOGS.USER_UID = dbo.USERS.USERID) as TableInfoWhere Row_Count Between ' + @startRowIndex + ' and ' + @maxRowIndex + ' ';Exec(@strSQL);
View 3 Replies
View Related
Jun 1, 2006
I'm having a heckuva time with creating output parameters based on a query.
Here's what I'm doing. Every day, we copy rows from our mysql table to our sql server table. We only want to copy those rows that are new, so as to not have to recopy the entire table.
So I have a DataReader Source set to Ado.net/odbc provider that connects to the mysql db.
The destination is an OLE connection to the local sql server.
I create an Execute SQL Task.
The connection is set to the OLE connection
The type is direct input
The SQL Statement is "select max(id) from copy_table"
In Parameter Mapping, I create a user variable called maxId that is an int64. That variable is now used as the Variable Name. The Direction is Output. The Parameter Name is 0.
Whatever data type I use for the mapping does not work with the variable type. If the parameter was set to ULARGE_INTEGER, here's the error
[Execute SQL Task] Error: Executing the query "SELECT MAX(stats_id) AS max_id FROM copy_table" failed with the following error: "Type name is invalid.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
If parameter is set to LONG:
[Execute SQL Task] Error: An error occurred while assigning a value to variable "maxId": "The type of the value being assigned to variable "User::maxId" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object. ".
I found that if variable and parameter were dates to use datetime for the variable and DBTIMESTAMP for the parameter.
There are an awful lot of combinations between all the possible variable types, and the possible parameter types. Does anyone know the secret combination for your typical integer?
Thanks,
Lori
View 5 Replies
View Related
Feb 19, 2007
I'd like to pass a multi-value parameter to a stored proc to satisfy an integer field lookup.
example -
CREATE PROC SSRSQuery
@InPublicationId VARCHAR(500) = NULL AS
SELECT * from Table where PublicationId IN (@InPublicationId)
where PublicationId is defined as an int
I've seen various posts on how to split up the input string parameter to use in a string-based lookup but nothing useful for an integer-based lookup.
Any tips or tricks for this?
View 3 Replies
View Related