Column Name As Parameter Dynamic Sql Alternative

Feb 11, 2008

I am unfortunately lumered with a table I cannot edit that stores a division 2 characters along with boolean fields '0506', '0607', '0708' ... (academic years) to represent if that particular division is active in the current academic year. This has made me have to resort to dynamic sql within a stored procedure to input the appropriate field names.

Is there a better way to do it, it's not mission critical to make it not use dynamic sql but I would prefer not to.

View 2 Replies


ADVERTISEMENT

Alternative To Dynamic Sql?

Jul 20, 2005

I have a procedure that take several paramters and depending of whatvalues is submitted or not, the procedures shall return differentnumber of rows. But to simplyfy this my example use just oneparameter, for example Idnr.If this id is submitted then I will return only the posts with thisidnr, but if this is not submitted, I will return all posts in table.As I can see I have two options1. IF @lcIdNr IS NOT NULLSELECT *FROM tableWHERE idnr = @lcIdNrELSESELECT *FROM table2. Use dynamic SQL.The first example can work with just one parameter but with a coupleof different input paramters this could be difficult, anyway this isnot a good solution. The second example works fine but as I understanddynamic sql is not good from the optimizing point of view. So, I don'twant to use either of theese options, so I wonder If there i a way towork around this with for example a case clause?RegardsJenny

View 3 Replies View Related

Alternative To Dynamic SQL In A Function

Jan 14, 2008

Hi all, I have a sql problem i'd like to put to the masses because its driving me crazy! Before I start, this is a database i inherited so I cant change the schema.
I have a table which holds field information for a form, namely the table name, column name and some other irrelevant stuff (X/Y coordinates for printing onto a document). Here is some sample data to explain better:
TableName              FieldName                Xpos             Ypos
----------               ---------                -----            -----
FruitTable                FruitName                10                20
VegTable                 VegName                 10                40
FruitTable                FruitColour               20                10  
(Thats not the real data of course)
What I need is a calculated field which returns the value of each field from each table – probably by constructing a dynamic sql statement(?) It would look something like this:
Select @FieldName From @TableName Where bla bla bla â€“ don’t worry about the where clause. The completed dataset will hopefully then look like this:
TableName              FieldName                Xpos             Ypos             FieldValue (calculated field)
----------               ---------                -----            -----            ---------      
FruitTable                FruitName                10                20                Oranges (result of: Select FruitName From FruitTable Where....)
VegTable                 VegName                 10                40                Parsnips (result of: Select VegName From VegTable Where....)
FruitTable                FruitColour               20                10                Green (result of: Select FruitColour From FruitTable Where....)
 
I have tried creating a scalar-valued function which takes TableName and FieldName as parameters and creates a dynamic sql string, but i cannot seem to execute the sql once I have built it. Here is a general idea of how I was trying to use the function:
Main query:Select
TableName, FieldName, Xpos, Ypos,
dbo.GetFieldValue(TableName, FieldName) As FieldValue
From
tblFieldAndPosition---------------Function: CREATE FUNCTION GetFieldValue (@TableName nvarchar(255),@FieldName nvarchar(255))

RETURNS nvarchar(255)
AS
BEGIN

Declare @SQL nvarchar(max)
Set @SQL = 'Select ' + @FieldName + ' From ' + @TableName

sp_executesql @SQL??

return ???

END ------------------------- The alternative to getting this data all out at once is contructing the sql statement in code and going back to the database once for every row - which i really dont want to do. If anyone has had a situation like this before, or can point me in the right direction I will be very very grateful.  Hope thats clear. Thanks in advance   

View 5 Replies View Related

Dynamic WHERE Clause Alternative.

Jun 26, 2007

I have 3 tables: Authors, Employee and Stores.
I need to create a stored procedure which will take 3 comma delimited parameters, to be able to query above 3 tables.
Basically my front end user can say give me Authors with last name starting from ‘A,B’ and Employee with first name starting from ‘J,N,K’ and Stores with city starting from ‘New, Los’.
So, stored procedure call will look like this Exec myStoredProcedure 'A,B' , 'J,N,K', 'New,Los' .

My question is, how should I handle WHERE clause in stored procedure if I don’t want it to be a “dynamic WHERE�.

Thank you

View 1 Replies View Related

Alternative To Dynamic SQL In A Function

Jan 15, 2008



Hi all, I have a sql problem i'd like to put to the masses because its driving me crazy! Before I start, this is a database i inherited so I cant change the schema.


I have a table which holds field information for a form, namely the table name, column name and some other irrelevant stuff (X/Y coordinates for printing onto a document). Here is some sample data to explain better:

TableName FieldName Xpos Ypos
---------- --------- ----- -----
FruitTable FruitName 10 20
VegTable VegName 10 40
FruitTable FruitColour 20 10

(Thats not the real data of course)

What I need is a calculated field which returns the value of each field from each table €“ probably by constructing a dynamic sql statement(?) It would look something like this:

Select @FieldName From @TableName Where bla bla bla €“ don€™t worry about the where clause. The completed dataset will hopefully then look like this:

TableName FieldName Xpos Ypos FieldValue (calculated field)
---------- --------- ----- ----- ---------
FruitTable FruitName 10 20 Oranges (result of: Select FruitName From FruitTable Where....)
VegTable VegName 10 40 Parsnips (result of: Select VegName From VegTable Where....)
FruitTable FruitColour 20 10 Green (result of: Select FruitColour From FruitTable Where....)

I have tried creating a scalar-valued function which takes TableName and FieldName as parameters and creates a dynamic sql string, but i cannot seem to execute the sql once I have built it. Here is a general idea of how I was trying to use the function:
Main query:Select
TableName, FieldName, Xpos, Ypos,
dbo.GetFieldValue(TableName, FieldName) As FieldValue
From
tblFieldAndPosition---------------Function: CREATE FUNCTION GetFieldValue (@TableName nvarchar(255),@FieldName nvarchar(255))

RETURNS nvarchar(255)
AS
BEGIN

Declare @SQL nvarchar(max)
Set @SQL = 'Select ' + @FieldName + ' From ' + @TableName

sp_executesql @SQL??

return ???

END ------------------------- The alternative to getting this data all out at once is contructing the sql statement in code and going back to the database once for every row - which i really dont want to do. If anyone has had a situation like this before, or can point me in the right direction I will be very very grateful. Hope thats clear. Thanks in advance

View 7 Replies View Related

Need Alternative To PATINDEX In Derived Column Transform

Oct 30, 2007

Hello,
I understand that it is not possible to use PATINDEX in a Derived Column transform. I'm trying to eliminate leading zeros from a column where the string is always 14 characters long, but the first non zero character could occur any number of characters from the left of the string. The following achieves what I need:


substring([Account No w/0s], patindex('%[^0]%', [Account No w/0s]), 14) AS ExtractedAcctNo


Does anyone happen to know how I might express this differently in a Derived Column transform? Should I consider a calling a function through an OLE DB Command transform on each row instead? Maybe I should have a SQL Task that runs an UPDATE statement against the column.

Thank you for your help!

cdun2

View 6 Replies View Related

Reporting Services :: Alternative Check Box Column Background Color Changes

Sep 8, 2015

I am working on SSRS 2008, I need to change background color of alternative columns. We can change simply if it is a textbox column but my columns all are in checkbox () based one expressions and I didn't see any background color option In properties for this check box column(please see the images below), is there any way to change background color  for alternative columns?I need like this

View 3 Replies View Related

Importing Excel Sheet Which Have Dynamic Column Name And Dynamic Number Of Columns

Aug 25, 2007

Hi Craig/Kamal,

I got your email address from your web cast. I really enjoyed the web cast and found it to be
very informative.

Our company is planning to use SSIS (VS 2005 / SQL Server 2005). I have a quick question
regarding the product. I have looked for the information on the web, but was not able to find
relevant information.

We are getting Source data from two of our client in the form of Excel Sheet. These Excel sheets
Are generated using reporting services. On examining the excel sheet, I found out that the name
Of the columns contain data itself, so the names are not static such as Jan 2007 Sales, Feb 2007 Sales etc etc.
And even the number of columns are not static. It depends upon the range of date selected by the user.

I wanted to know, if there is a way to import Excel sheet using Integration Services by defining the position
Of column, instead of column name and I am not sure if there is a way for me to import excel with dynamic
Number of columns.

Your help in this respect is highly appreciated!

Thanks,


Hi Anthony, I am glad the Web cast was helpful.

Kamal and I have both moved on to other teams in MSFT and I am a little rusty in that area, though in general dynamic numbers of columns in any format is always tricky. I am just assuming its not feasible for you to try and get the source for SSIS a little closer to home, e.g. rather than using Excel output from Reporting Services, use the same/some form of the query/data source that RS is using.

I suggest you post a question on the SSIS forum on MSDN and you should get some good answers.
http://forums.microsoft.com/msdn/showforum.aspx?forumid=80&siteid=1
http://forums.microsoft.com/msdn/showforum.aspx?forumid=80&siteid=1

Thanks



Craig Guyer
SQL Server Reporting Services

View 12 Replies View Related

Column Data To Column Heading By Dynamic Pivot Maybe

Feb 27, 2008



Hi there,
I am a new member of this site and I am not very much aware of T-sql's working.
My question is what if I need to get one column's data to be the heading of another column.
To be very exact I have a school's database. The table I am talking about is of the results of students. The table contains Student ID, Subject ID, Total marks of the subject, Marks obtained in the subject. Now I want to print a report by generating data from this table. Right now the data is something like this
StuID - - - SubID - - - -Tot - - -Obt
1 - - - - - - -1 - - - - - - -50 - - - 38
1 - - - - - - -2 - - - - - - -50 - - - 41
1 - - - - - - -3 - - - - - - -50 - - - 42
1 - - - - - - -4 - - - - - - -50 - - - 40
2 - - - - - - -1 - - - - - - -50 - - - 35
2 - - - - - - -2 - - - - - - -50 - - - 40
2 - - - - - - -3 - - - - - - -50 - - - 42
2 - - - - - - -4 - - - - - - -50 - - - 41

StudentID and SubjectID fields are related to other tables so I can get the names from there but when I need the report I need the data in the form of
StuID - Sub 1 - - - Sub 2 - - - Sub 3 - - - -Sub4
1 - - - - 38 - - - - - - 41 - - - - - - 42 - - - - - - 40
2 - - - - 35 - - - - - - 40 - - - - - - 42 - - - - - - 41

The Subjects can be different for different students so the query should be dynamic instead of hard coding the names of the subjects. I hope I am clear with my question. The subjectIDs or their names will become the headings and they will contain the obtained marks for that subjects in their columns just for the reports. I have also checked the PIVOT function but was not able to do what I wanted.
Thanks.

View 9 Replies View Related

DTS And Dynamic Connection Parameter

Feb 19, 2001

Hi,

i want to modify my DTS to don't have any maintenance to do on it if a Username or password change.

Each DTS will have an ActiveX script to read connections properties in a table that i created and will automatically set each connection in the DTS each time that the DTS Run. So, we will have only to update the table and the DTS will continue working fine.

To update the Connections properties i have no problem, the problem is how can i retrieve the data from my table to get the connection properties, without hardcoding a connection inside my ActiveX script? Because i don't want to have to change each ActiveX script in each DTS if the SQL Server paswword change.

Any idea will be appreciated

Thank

Martin

View 3 Replies View Related

MDX Dynamic Parameter Syntax

Nov 12, 2007



I have a SSRS report that I'm passing a dynamic parameter to another SSRS report.
The datasourse is a SSAS cube. Can anyone tell me the if following syntax is correct for receiveing report.
I'm having trouble creating the datasource for the second report. I'm new at SSRS so any help would be appreciated.

When I parse this code in management Studio I get the following
An MDX Statement was expected. An MDX expression was specified.


'= [SELECT NON EMPTY { [Measures]].[Qty Paid]], [Measures]].[US Cost]], [Measures]].[Qty Recd]] } ON COLUMNS, NON EMPTY

{ ([Division_Plant]].[Hierarchy]].[Plant Desc]].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS

FROM ( SELECT ( STRTOSET(([

+ " Parameters ! DivisionPlantDivisionDesc.Value + "[), CONSTRAINED) ) ON COLUMNS FROM [New GOLD]])

WHERE ( IIF( STRTOSET(([ " + Parameters ! DivisionPlantDivisionDesc.Value

+ " [), CONSTRAINED).Count = 1, STRTOSET(([ " + Parameters ! DivisionPlantDivisionDesc.Value + " [),

CONSTRAINED), [Division_Plant]].[Division Desc]].currentmember ) )

CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS'

View 6 Replies View Related

Dynamic SQL && Parameter Inside A SP Not Working

Nov 5, 2006

When I run the query below on my DB, it gives the following error:
Server: Msg 8114, Level 16, State 5, Procedure partstlist ...Error converting data type varchar to float.
Only after I replace the      " + @d + " section with a float numnber such as 39020.5 does it work fineIt's reported that my temporary table named #tbl doesn't exist within the scope of the environment that the EXEC(UTE) command operates.Someone said that I couldn't combine dynamic SQL and temporary tables or table variables...and that I would have to use a global temp table "##tbl" or a permanent table.
So here I have appearantly a "DYNAMiC SQL & TEMPORARY TABLE" problem. That's sure.
But I don't have much knowledge and experience with SQL tables and have difficulty forming a global temp table "##tbl" or a permanent table.and I have to employ the datetime variable dynamically @d inside the Dynamic SQL string.
So what kind of a code should I use here to properly combine Dynamic SQL string with my dynamic datetime variable? I'd be grateful if you could post your code suggestions so that I can try them on my DB ..
alter PROCEDURE partslist@no INT,@dt DATETiMEASDECLARE @s VARCHAR(5000)DECLARE @d floatSET @d = CONVERT (float, @dt2)create TABLE #tbl(pageindex int IDENTITY(1,1) PRIMARY KEY , prt_name varchar(50), prt_country varchar(50) , prt_date smalldatetime, partID int , prt_cat varchar(50),prt_product_type nvarchar(10), producer_company nvarchar(50), producer_city nvarchar(50), prt_released DATETIME, dvalue float, datevalue varchar(26) )BEGiNSET ANSI_WARNINGS OFFSET ROWCOUNT @noSELECT @s = 'INSERT INTO #tbl SELECT prt_name, Countries.Val AS ''prt_country'' , prt_date, partID , partsCategories.Val AS ''prt_cat'' , partsProductTypes.Val AS ''prt_product_type'' , producers.producer_company AS ''producer_company'' , producers.producer_city AS ''producer_city'' ,  prt_released , CONVERT (float, prt_released) , CONVERT (varchar(26) , prt_released, 109) FROM producer_parts  JOIN partsProductTypes ON (producer_parts.prt_product_type = partsProductTypes.ID) JOIN partsCategories ON (producer_parts.prt_cat = partsCategories.ID)JOIN Countries ON (producer_parts.prt_country = Countries.ID) JOIN producers ON (producer_parts.producerID = producers.producerID) WHERE prt_visible = 1  AND CONVERT (float, prt_released) > ' + @d + ' AND CONVERT (float, prt_released) < 39025.5ORDER BY prt_released DESC SELECT * FROM  #tbl'EXEC (@s)SET ROWCOUNT 0ENDGO partslist 10 , '10.10.2006 10:10:10' -- This is just to test the SP.
This code may not be syntatically correct, it's a re-edited version of my code which works fine in my DB.

View 2 Replies View Related

Schedule Subcription With Dynamic Parameter

Feb 15, 2008

Hi all,

I'm working with Schedule Subcription with parameter @startdate in SQL 2005 Standard version. The @startdate is depend on user needs, I've tried to use DayAdd() function in the parameter but don't work. How can I set the parameter in subcription to do it?
Thanks!

View 4 Replies View Related

Dynamic Parameter Values For Subscription

Jan 26, 2008

I have been trying to add in date functions for parameters in a report subscription and they are not accepted. I have a report with 2 parameters, @start and @end. I have default parameters set wtihin the report of Now - month for @start and Now for @end. Can my users create a subscriotion using something like "=DateAdd("D", -1, Now)" for the parameters rather than the default?

View 8 Replies View Related

How To Pass Dynamic Parameter To Order BY Clause

Sep 13, 2004

Hi,

I use a DataGrid to show the data, and I want it has a sorting and Paging function,
so I use dataset to collect the data from middle tier function and stored procedure.
I have code in aspx page like BindData(ViewState("SortExpr")).

In the stored procedure I pass SortExpr as parameter as following:

CREATE Procedure Ruying_AutoSearch10
(
@Make varchar(50),
@Model varchar(50) = NULL,
@Condition varchar(20) = NULL,
@Miles float,
@Zipcode varchar(5),
@SortExpr varchar(100)
)
AS

DECLARE @RowCount int
SELECT @RowCount = Count(*) FROM ZIPCodes WHERE ZIPCode = @Zipcode AND CityType = 'D'

if @RowCount > 0
BEGIN
SELECT
z.ZIPCode, z.City, z.StateCode, a.Make, a.Model, a.AutoPrice, a.AutoPrice2, a.AutoYear, a.Mileage, a.AdID, a.ImageURL, dbo.DistanceAssistant(z.Latitude,z.Longitude,r.Latitude,r.Longitude) As Distance
/*
The above functions requires the Distance Assistant.
*/
FROM
ZIPCodes z, RadiusAssistant(@ZIPCode,@Miles) r, AutoAd a
WHERE
z.Latitude <= r.MaxLat
AND z.Latitude >= r.MinLat
AND z.Longitude <= r.MaxLong
AND z.Longitude >= r.MinLong
AND z.CityType = 'D'
AND z.ZIPCodeType <> 'M'
AND z.ZIPCode = a.Zipcode
AND a.AdActive = '1'
AND a.AdExpiredate >= getdate()
AND a.Make = @Make
AND a.Model = IsNull(@Model,a.Model)
AND a.Condition = IsNull(@Condition, a.Condition)
AND dbo.DistanceAssistant(z.Latitude,z.Longitude,r.Latitude,r.Longitude) <= @Miles
ORDER BY @SortExpr
END
ELSE
SELECT -1 As ZIPCode
--ZIP Code not found...
GO


but I got the error as "variables are only allowed when ordering by an expression referenceing
a column name". How I fix this error? Please help.

Thanks.

Lin

View 9 Replies View Related

Output Parameter Not Fetched From Dynamic T-SQL Procedure

Sep 9, 2005

I have a STORED PROC for dynamic T-SQL that returns a OUTPUT varaible of typevarchar . This works fine in query analyzer.
But when I try to get values in asp.net page it does not return anything. No execeptions or errors also. Below is the code snippet
HDConn = CommonMethods.BuildConnection();SqlCommand cmd1 = new SqlCommand("GenerateRowids",HDConn);cmd1.CommandType = CommandType.StoredProcedure;// add parameters for Proccmd1.Parameters.Add("@TableName",SqlDbType.VarChar,50).Value= "MetricsMaster";cmd1.Parameters.Add("@ColumnName",SqlDbType.VarChar,50).Value= "MetricId";cmd1.Parameters.Add("@rowidval",SqlDbType.VarChar,30);cmd1.Parameters["@rowidval"].Direction = ParameterDirection.Output;try{cmd1.ExecuteNonQuery();//the below line does not print the valueResponse.Write(cmd1.Parameters["@rowidval"].Value.ToString());}My stored proc looks like :CREATE PROCEDURE dbo.GenerateRowids@TableName varchar(50),@ColumnName varchar(50),@rowidval varchar(30) outputASBegindeclare @sql nvarchar(4000), @Idval varchar(50)
set  @sql = N'select left(MAX(' + @ColumnName +') ,1)+ convert(varchar(5),Cast(SUBSTRING((MAX(' +@ColumnName+ ')),2,(len(MAX(' +@ColumnName+ '))))as int)+1) from  ' + @TableNameexec sp_executesql @query = @sql,@params = N'@rowidval varchar OUTPUT', @rowidval = @rowidval OUTPUT ENDGO

View 11 Replies View Related

Using Of Substring With Dynamic Values For Length Parameter

Feb 12, 2003

Hi everybody,

I want to use substring with dynamic
values for length parameter
but result is different compare to
static parameter.

declare
@x smallint,
@y smallint,
@string varchar(250)


set @x = 0
set @string = '17898880219800alex3.5'

select @y = charindex('',@string,@x)
-- result varchar(5)
select substring(@string,@x,5)

select @y
-- result varchar(250) !!!!!!

select substring(@string,@x,@y)

Any Idea why ?

View 3 Replies View Related

Check Multiple Parameter Instead Of Dynamic Query?

Oct 20, 2014

how to check multiple parameter instead of dynamic query.

View 1 Replies View Related

Dynamic Default Value For Parameter In OLAP Report

Apr 16, 2007

I'm trying to set up a parameter report from a OLAP cube. I need 3 dynamic parameters(ThisYear, ThisMonth, YESTERDAY).



THISYEAR: =CStr(DatePart("yyyy",Today()))

THISWEEK: =CSTR(DATEPART("ww",Today()))

YESTERDAY: =CSTR(Datepart("d", Today().AddDays(-1)))



So far so good. I want to send this report by email everyday, so I need to set these parameters as a default value. This is where I run into problems.

When I add any of these parameters I get the following error "The restrictions by the CONSTRAINED flag in the STRTOSET function were violated". This problem occur when I choose NON-queried under Report->Report Parameters, and set a default value for THISYEAR under DEFAULT VALUES

=CStr(DatePart("yyyy",Today()))



Hope someone found a way around this problem.



Thanks in advance!

View 2 Replies View Related

Dynamic Default Value For Parameter In OLAP Report

Feb 28, 2007

I have a basic SSRS report against an SSAS database with a "start date" parameter. I want to set the default value of that date parameter to Today's date. What is the easiest way to do this? I have no problem doing it against a relational source, just haven't done it against an OLAP source.

Thanks for any ideas.

-Josh R.

View 1 Replies View Related

Dynamic Date Parameter In Report Manager

Sep 11, 2006

Hi all,

I was wondering if there's a way to override the default date parameter of a report to a dynamic value such as Today(), Now(), DateAdd(),... through Report Manager.

I know this can be done in Report Designer, but never been successful when I try to change the date parameter value in Report Manager.

I've tried to change the date parameter value by clicking on the Override Default button in the report's properties page from Report Manager, error like the one below will be shown after I entered Now() in the Default Value field and clicked Apply:
The value provided for the report parameter 'StartDate' is not valid for its type. (rsReportParameterTypeMismatch)

Thanks in advance.

View 4 Replies View Related

Dynamic Query: Using Parameter As A Part Of Table Name (possible?)

Mar 12, 2008


I have 2 tables (table1KKK, table2KKK), and want to run the same query on them by using parameter with the value "1" or "2".
Is it possible to use that parameter as a part of the queried table name?
Something like (only for demonstration €“ doesn€™t work):
Select *
From table +myParameter + kkk
Thanks in advance!

View 3 Replies View Related

Analysis :: Dynamic Default Values For Parameter

Nov 11, 2015

I am trying to write a query for the default values for month, and I am stuck in bringing out only the parameter values, the query I have , brings back the month on row and value on column, and I am trying to get the value out. and will ssrs accept it as a valid expression for a default value

WITH 
MEMBER
[MEASURES].[PARAMETERVALUE]
AS
[Account].[Month Short Name].CURRENTMEMBER.UNIQUENAME

[Code] .....

I tried using the exp

=Parameters!MONTH.Value(0)

so as to return the first parameter in the parameter dataset , but i have the error the expression that ref the parameter MONTH does not exists in the parameter collection.

View 2 Replies View Related

How To Execute A Dynamic SQL With Integer Parameter For Stored Procedure?

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

How To Call Via CLR One Dll Which Calls Two Webservices (endpoints) With Dynamic Parameter

May 23, 2007

I developed one DLL in vb .Net which call two web services (sql endpoints) I wish to use this solution but for hundreds of servers (endpoints) I want to ask if I could do that with dynamic parameters passed to de DLL CALL in sql server clr.

Actually when I compile de DLL I need to have referenced (hardcoded) the webservices (endpoints) and when I need a brand new endpoint I need to reference it, compile the dll and release.



I cannot find how to invoke the service within the DLL with the namespace or webservice name as parameter.



Mi code to invoke now my referenced end point is: (note that my endpoint name is rperez)



Dim CallWebService As New rperez.IntelisisServiceEndPoint

CallWebService.Credentials = System.Net.CredentialCache.DefaultCredentials

Call CallWebService.IntelisisService(ArchivoOriginal)





My class rperez.IntelisisServiceEndPoint is referenced (hardcoded) in the dll project I need it dynamic



Do I need to change my code to PROXY object ?

View 1 Replies View Related

Dynamic Parameter Value Preservation Problem When Click On View Report.

Sep 17, 2007

Hi Friends,

I have used some dynamic parameter of type string and integer.

When I hit my detail report from my menu report(Where I pass the values for these parameters from menu to detail). The Detail Report comes fine.

But when I click view report button of my detail report the vaues for all these parameters are set to default value.

So the parameters are not able to retain their pass value from the menu report.

This thing is happening when I m hiting the published report but the reports are working fine in Report designer.

Please help me.

Thanks
Novin

View 3 Replies View Related

Reporting Services :: SSRS Parameter Dynamic Font Size

Oct 22, 2015

Is there any possibility to have the  Defaultvalue of  a Parameter in Bold fonts and rest of it as Default parametervalue=Defaultvalue ,"Bold","Default".So for example in drop down of parameter if the C is the current value it would look like this:

ParameteValue:
A
B
C
D

View 3 Replies View Related

SSRS -- Data Driven Subscription And Pivoting For Dynamic Parameter Mapping

Feb 12, 2007

Hi,

For the Data Driven Subscription in SSRS we are using the following stored procedure

In Step 3 - Create a data-driven subscription



create procedure spRSGetReportSettings

(

@ReportID as integer

) as

begin

set nocount on

declare @t as table(y int not null primary key)

declare

@cols as nvarchar(max),

@y as int,

@sql as nvarchar(max)

set @cols=stuff(

(select N',' + quotename(y) as [text()]

from (select ParameterName as y from Reportsettings where reportid=1) as Y

order by y

For XML Path('')),1,1,N'');

set @sql=N'select * from

(select reportid,parametername, parametervalue from ReportSettings where reportid= ' + Cast(@ReportID as varchar(5)) +' ) as D

pivot(min(parametervalue) for parametername in(' + @cols +N')) as p'

exec sp_executesql @sql

end



Basically the idea is to maintain a single report parameter setting table for multiple reports.

Structure of the table is as given below

ReportID, ParameterName, ParameterValue.

Using Pivot we can generate the ParameterName/ParameterValue combinations for each report. This stored procedure is working fine in query editors(Management Studio)

But, in SSRS it is giving any results.

In Step 4 - Create a data-driven subscription,

Get the value from the database drop down, I am not getting any database columns.

Please help.

Kumar

View 3 Replies View Related

Dynamic Column Name (using Where)

Jun 13, 2007

Hello All,

I'm trying to us a parameter as column name like:

Select * From SM_Clients
where @Selection like @SelectionChar+'%'

This dos not work.

does someone have a solution :(

tks stroek

View 11 Replies View Related

Dynamic Column Name (using Where)

Jun 13, 2007

Hello All,

I'm trying to us a parameter as column name like:

Select * From SM_Clients
where @Selection like @SelectionChar+'%'

This dos not work.

does someone have a solution

tks stroek

View 5 Replies View Related

Dynamic Column Names In A SP

Jan 1, 2008

Hello,I'm still extremely novice to SQL and I've tried googling how to produce this result but I've been encountering a lot dynamic sql commands which isn't exactly what I want. If this is an ignorant question I do apologize but heres my scenario: I have a table with columns of the day, for instance: Monday_hasData (bit)Monday_DataAnd what I want to do is essentially pass in "Monday" as a parameter and rather than doing an If statement on each row, I would like to just like to do something like assign @dayCheck + "_hasData" to a variable and then use @dayCheck as part of my query.  Is this possible or am I going to have to have 7 cases? Thank you for any input,Chance 

View 2 Replies View Related

Rename The Column By Using The Dynamic Value

Feb 5, 2008

Hi All
I want to rename the column name by using the dynamic value as like
declare @name as varchar(12) set @name='ss'
sp_rename 'dbo.employees.id3',@name, 'COLUMN';
go
but it shows the error
Incorrect syntax near 'sp_rename'.
any idea?

View 5 Replies View Related

Dynamic Column Names

Jun 10, 2004

Hi is possible to create dynamic column name
example
Declare
@StartDate as dateTime
Select @StartDate = '2004-06-05'

select
SUM(Case When table1_date BETWEEN dateadd(day,-6,@StartDate) and @StartDate then 1 else 0 end)AS [dateadd(day,-6,@StartDate)],
SUM(Case When table1_date BETWEEN dateadd(day,-13,@StartDate) and dateadd(day,-7,@StartDate) then 1 else 0 end)AS [dateadd(day,-13,@StartDate)]
from
table1

View 2 Replies View Related







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