Friday, March 30, 2012
How to get the value of a parameter programmatically
Say I have connected to the webs ervice and extracted all the parameters of
a particular report ,,how can I show the default bvalue of those parameter
if any'
thanks for your help,,here is my code:
ReportingService rs = new ReportingService(enviromental_Vars.LocalPath);
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
//string report = this.cmbReports.Items[this.cmbReports.SelectedIndex].ToString();
bool forRendering = false;
string historyID = null;
ParameterValue[] values = null;
DataSourceCredentials[] credentials = null;
ReportParameter[] parameters = null;
try
{
parameters = rs.GetReportParameters(enviromental_Vars.ReportName, historyID,
forRendering, values, credentials);
if (parameters != null)
{
}
}There is a property on the ReportParameter class with the name of
DefaultValues, and of type string[].
You could use something along the lines of:
foreach(ReportParameter p in parameters)
{
string[] defaults = p.DefaultValues;
// work on defaults...
}
--
Scott
http://www.OdeToCode.com/blogs/scott/
On Fri, 12 Nov 2004 19:12:19 -0800, "ALI-R" <newbie@.microsoft.com>
wrote:
>Hi,,
>Say I have connected to the webs ervice and extracted all the parameters of
>a particular report ,,how can I show the default bvalue of those parameter
>if any'
>thanks for your help,,here is my code:
>ReportingService rs = new ReportingService(enviromental_Vars.LocalPath);
>rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
>//string report =>this.cmbReports.Items[this.cmbReports.SelectedIndex].ToString();
>bool forRendering = false;
>string historyID = null;
>ParameterValue[] values = null;
>DataSourceCredentials[] credentials = null;
>ReportParameter[] parameters = null;
>try
>{
>parameters = rs.GetReportParameters(enviromental_Vars.ReportName, historyID,
>forRendering, values, credentials);
>if (parameters != null)
>{
>
>}
>}
>
Monday, March 26, 2012
How to Get the Output Column in OLE DB Command Transformation
Hi,
I am writing a Dataflow task which will take a Particular column from the source table and i am passing the column value in the SQL command property. My SQL Command will look like this,
Select SerialNumber From SerialNumbers Where OrderID = @.OrderID
If i go and check the output column in the Input and output properties tab, I am not able to see this serial number column in the output column tree,So i cant able to access this column in the next transformation component. ![]()
Please help me.
Thanks in advance.
Hi,I am writing a Dataflow task which will take a Particular column from the source table and i am passing the column value in the SQL command property. My SQL Command will look like this,
Select SerialNumber From SerialNumbers Where OrderID = ?
If i go and check the output column in the Input and output properties tab, I am not able to see this serial number column in the output column tree,So i cant able to access this column in the next transformation component. ![]()
Please help me.
Thanks in advance.
|||It sounds as tho you are using the wrong component. To source stuff use the OLE DB Source Adapter, not the OLE DB Command.
-Jamie
|||
Dear Jamie,
Thanks for such a quick reply.
U Mean OLEDB Source From DataFlow Sources.
Actually the My dataflow task contains one OLEDB source component which is having connection to one table, from that table i am getting the orderID column, Then i am passing this OrderID column values to the query Which will get the serialnumber in the SerialNumbers table based on this OrderID. And my problem is i cant able to get this selected serialnumber column in the output column tree view,so i that column is not accessable for futher transformations.
Please give me some solution.
Thanks in advance.
- Dhivya
|||You need the LOOKUP transform. That s exactly what it does.
-Jamie
|||
Dear Jamie,
That also i tried,the table contains multiple values(for same OrderID multiple serial numbers) and the lookup transform will take only the first value and map the same to the others.
-Dhivya
|||So its a many-to-many?
Then you should use the MERGE JOIN component!
-Jamie
|||
Good advice, Jamie.
Dhivya, remember that the Merge Join needs a sorted input, so you'll also need to use sort components. Alternatively, use ORDER BY in the source queries, and set the IsSorted property of the source adapter output to True.
Donald
|||I tried merge join, the problem is order ID is not unique in my source table and in transaction table. so if i put some inner or left joins i am not getting the values what i want.
-Dhivya
|||Merge Join worked for me. I did right outer join.
Thank u Jamie and donald.
But still my question is, we cant get the output columns in OLE DB Command Component if we use select command? ![]()
No. That's not what its for!
-Jamie
|||
OK. Thanks a lot ![]()
-Dhivya
Monday, March 19, 2012
How to Get SQL Query
Just wondering if anyone knows of a way to get the SQL query that a
particular report is using. I keep getting "Unable to set commandtext" when
trying to run a dynamic query and can't figure out why. I don't believe the
query is getting to the server because I cannot see it in SQL profiler.
It would be helpful to know what query reporting services is attempting to
use.
Any help would be greatly appreciated.
Regards,
BenTry the static version of the query first and see if it returns the data
successfully. Then use the dynamic version. Can you post the query
expression?
--
Ravi Mumulla (Microsoft)
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Benjamin Pierce" <bpierce@.opentext.com> wrote in message
news:eSg$BqthEHA.1656@.TK2MSFTNGP09.phx.gbl...
> Hello,
> Just wondering if anyone knows of a way to get the SQL query that a
> particular report is using. I keep getting "Unable to set commandtext"
when
> trying to run a dynamic query and can't figure out why. I don't believe
the
> query is getting to the server because I cannot see it in SQL profiler.
> It would be helpful to know what query reporting services is attempting to
> use.
> Any help would be greatly appreciated.
> Regards,
> Ben
>|||Well I've been doing that, but unfortunately it craps out on the dynamic
portion (because there's a heck of a lot of IIF statements). Doesn't MSRS
compile the whole statement into a string first, then send it off to SQL
Server? It would be nice to get the string it compiled so I can know if I
made a typo somewhere rather than doing it the hard way (removing each IIF
statement one by one until I find the typo).
Was hoping there would be a backdoor to get this string...
"Ravi Mumulla (Microsoft)" <ravimu@.online.microsoft.com> wrote in message
news:eSX223thEHA.3944@.tk2msftngp13.phx.gbl...
> Try the static version of the query first and see if it returns the data
> successfully. Then use the dynamic version. Can you post the query
> expression?
> --
> Ravi Mumulla (Microsoft)
> SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> "Benjamin Pierce" <bpierce@.opentext.com> wrote in message
> news:eSg$BqthEHA.1656@.TK2MSFTNGP09.phx.gbl...
> > Hello,
> >
> > Just wondering if anyone knows of a way to get the SQL query that a
> > particular report is using. I keep getting "Unable to set commandtext"
> when
> > trying to run a dynamic query and can't figure out why. I don't believe
> the
> > query is getting to the server because I cannot see it in SQL profiler.
> >
> > It would be helpful to know what query reporting services is attempting
to
> > use.
> >
> > Any help would be greatly appreciated.
> >
> > Regards,
> >
> > Ben
> >
> >
>|||What I do is to have a textbox with the expression so I can copy and paste
it into query analyzer. Try this without a dataset until you get what you
want and then go back to creating a dataset.
Bruce L-C
"Benjamin Pierce" <bpierce@.opentext.com> wrote in message
news:eXGcPLuhEHA.632@.TK2MSFTNGP12.phx.gbl...
> Well I've been doing that, but unfortunately it craps out on the dynamic
> portion (because there's a heck of a lot of IIF statements). Doesn't MSRS
> compile the whole statement into a string first, then send it off to SQL
> Server? It would be nice to get the string it compiled so I can know if I
> made a typo somewhere rather than doing it the hard way (removing each IIF
> statement one by one until I find the typo).
> Was hoping there would be a backdoor to get this string...
>
> "Ravi Mumulla (Microsoft)" <ravimu@.online.microsoft.com> wrote in message
> news:eSX223thEHA.3944@.tk2msftngp13.phx.gbl...
> > Try the static version of the query first and see if it returns the data
> > successfully. Then use the dynamic version. Can you post the query
> > expression?
> >
> > --
> > Ravi Mumulla (Microsoft)
> > SQL Server Reporting Services
> >
> > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> > "Benjamin Pierce" <bpierce@.opentext.com> wrote in message
> > news:eSg$BqthEHA.1656@.TK2MSFTNGP09.phx.gbl...
> > > Hello,
> > >
> > > Just wondering if anyone knows of a way to get the SQL query that a
> > > particular report is using. I keep getting "Unable to set
commandtext"
> > when
> > > trying to run a dynamic query and can't figure out why. I don't
believe
> > the
> > > query is getting to the server because I cannot see it in SQL
profiler.
> > >
> > > It would be helpful to know what query reporting services is
attempting
> to
> > > use.
> > >
> > > Any help would be greatly appreciated.
> > >
> > > Regards,
> > >
> > > Ben
> > >
> > >
> >
> >
>|||You can also use SQL Profiler to capture the actual statement being sent to
SQL server.
hth, Mike
"Bruce Loehle-Conger" <bruce_lc@.hotmail.com> wrote in message
news:efgDjZvhEHA.3992@.TK2MSFTNGP11.phx.gbl...
> What I do is to have a textbox with the expression so I can copy and paste
> it into query analyzer. Try this without a dataset until you get what you
> want and then go back to creating a dataset.
> Bruce L-C
> "Benjamin Pierce" <bpierce@.opentext.com> wrote in message
> news:eXGcPLuhEHA.632@.TK2MSFTNGP12.phx.gbl...
> > Well I've been doing that, but unfortunately it craps out on the dynamic
> > portion (because there's a heck of a lot of IIF statements). Doesn't
MSRS
> > compile the whole statement into a string first, then send it off to SQL
> > Server? It would be nice to get the string it compiled so I can know if
I
> > made a typo somewhere rather than doing it the hard way (removing each
IIF
> > statement one by one until I find the typo).
> >
> > Was hoping there would be a backdoor to get this string...
> >
> >
> > "Ravi Mumulla (Microsoft)" <ravimu@.online.microsoft.com> wrote in
message
> > news:eSX223thEHA.3944@.tk2msftngp13.phx.gbl...
> > > Try the static version of the query first and see if it returns the
data
> > > successfully. Then use the dynamic version. Can you post the query
> > > expression?
> > >
> > > --
> > > Ravi Mumulla (Microsoft)
> > > SQL Server Reporting Services
> > >
> > > This posting is provided "AS IS" with no warranties, and confers no
> > rights.
> > > "Benjamin Pierce" <bpierce@.opentext.com> wrote in message
> > > news:eSg$BqthEHA.1656@.TK2MSFTNGP09.phx.gbl...
> > > > Hello,
> > > >
> > > > Just wondering if anyone knows of a way to get the SQL query that a
> > > > particular report is using. I keep getting "Unable to set
> commandtext"
> > > when
> > > > trying to run a dynamic query and can't figure out why. I don't
> believe
> > > the
> > > > query is getting to the server because I cannot see it in SQL
> profiler.
> > > >
> > > > It would be helpful to know what query reporting services is
> attempting
> > to
> > > > use.
> > > >
> > > > Any help would be greatly appreciated.
> > > >
> > > > Regards,
> > > >
> > > > Ben
> > > >
> > > >
> > >
> > >
> >
> >
>|||The original post mentions that the SQL statement is not showing up in
profiler.
Could you post your query expression?
--
Ravi Mumulla (Microsoft)
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Mike Morisoli" <michael@.removeme.vieon.net> wrote in message
news:e%23$l8qwhEHA.4092@.TK2MSFTNGP10.phx.gbl...
> You can also use SQL Profiler to capture the actual statement being sent
to
> SQL server.
> hth, Mike
> "Bruce Loehle-Conger" <bruce_lc@.hotmail.com> wrote in message
> news:efgDjZvhEHA.3992@.TK2MSFTNGP11.phx.gbl...
> > What I do is to have a textbox with the expression so I can copy and
paste
> > it into query analyzer. Try this without a dataset until you get what
you
> > want and then go back to creating a dataset.
> >
> > Bruce L-C
> >
> > "Benjamin Pierce" <bpierce@.opentext.com> wrote in message
> > news:eXGcPLuhEHA.632@.TK2MSFTNGP12.phx.gbl...
> > > Well I've been doing that, but unfortunately it craps out on the
dynamic
> > > portion (because there's a heck of a lot of IIF statements). Doesn't
> MSRS
> > > compile the whole statement into a string first, then send it off to
SQL
> > > Server? It would be nice to get the string it compiled so I can know
if
> I
> > > made a typo somewhere rather than doing it the hard way (removing each
> IIF
> > > statement one by one until I find the typo).
> > >
> > > Was hoping there would be a backdoor to get this string...
> > >
> > >
> > > "Ravi Mumulla (Microsoft)" <ravimu@.online.microsoft.com> wrote in
> message
> > > news:eSX223thEHA.3944@.tk2msftngp13.phx.gbl...
> > > > Try the static version of the query first and see if it returns the
> data
> > > > successfully. Then use the dynamic version. Can you post the query
> > > > expression?
> > > >
> > > > --
> > > > Ravi Mumulla (Microsoft)
> > > > SQL Server Reporting Services
> > > >
> > > > This posting is provided "AS IS" with no warranties, and confers no
> > > rights.
> > > > "Benjamin Pierce" <bpierce@.opentext.com> wrote in message
> > > > news:eSg$BqthEHA.1656@.TK2MSFTNGP09.phx.gbl...
> > > > > Hello,
> > > > >
> > > > > Just wondering if anyone knows of a way to get the SQL query that
a
> > > > > particular report is using. I keep getting "Unable to set
> > commandtext"
> > > > when
> > > > > trying to run a dynamic query and can't figure out why. I don't
> > believe
> > > > the
> > > > > query is getting to the server because I cannot see it in SQL
> > profiler.
> > > > >
> > > > > It would be helpful to know what query reporting services is
> > attempting
> > > to
> > > > > use.
> > > > >
> > > > > Any help would be greatly appreciated.
> > > > >
> > > > > Regards,
> > > > >
> > > > > Ben
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
How to get size of a table
Hello,
I want to get size of a particular table. I have used the wizard provided by SQL Server Enterprise Manager. But it is giving wrong size. If the data of some cells has been deleted or some rows are deleted. It shows the same size which it shows for the first time. I have also used sp_spaceused but is showing the same behaviour as mentioned above. I deleted some rows from the table but is showing the same size.I want to know the size exactly, so that i can come to know that some rows has been deleted or data is corrupted. Please tell me the solution as early as possible.
Haider Ali Khan
sp_spaceused()Monday, March 12, 2012
How to get rowcount
Hi,
How to get the row count for a particular query being executed within a session and scope. is there any option to get the value being displayed in the messages tab when a query is executed (no of rows affected). is there anything equivalent to scope_identity for getting the identity value inserted in a session and scope.
Vivek S
to obtain number of rows affected...
@.@.RowCount (return an int)
RowCount_Big() (return a big int)
to obtain last genereted identiy value...
@.@.IDENTITY, SCOPE_IDENTITY, and IDENT_CURRENT are similar functions because they all return the last value inserted into the IDENTITY column of a table.
@.@.IDENTITY and SCOPE_IDENTITY return the last identity value generated in any table in the current session. However, SCOPE_IDENTITY returns the value only within the current scope; @.@.IDENTITY is not limited to a specific scope.
IDENT_CURRENT is not limited by scope and session; it is limited to a specified table. IDENT_CURRENT returns the identity value generated for a specific table in any session and any scope. For more information, see IDENT_CURRENT (Transact-SQL).
The scope of the @.@.IDENTITY function is current session on the local server on which it is executed. This function cannot be applied to remote or linked servers. To obtain an identity value on a different server, execute a stored procedure on that remote or linked server and have that stored procedure (which is executing in the context of the remote or linked server) gather the identity value and return it to the calling connection on the local server.
|||did this help?Wednesday, March 7, 2012
How to get most used data from table
want to see which are the most entered 100 endsites for a particular
beginsite.Any
pointers on the query ?
regards,
aniI am not sure if I understand your request but try this:
SELECT TOP 100 EndSite, COUNT(*) AS Totals
FROM YourTable
WHERE BEginSite = xxx
GROUP BY EndSite
ORDER BY COUNT(*) DESC
Andrew J. Kelly SQL MVP
"c_ani" <cani@.discussions.microsoft.com> wrote in message
news:88D1830B-18EB-4AEF-B4E5-9AEF499A3CE6@.microsoft.com...
>I have a table where there are two columns like beginsite and endsite.Now,i
> want to see which are the most entered 100 endsites for a particular
> beginsite.Any
> pointers on the query ?
> regards,
> ani
Friday, February 24, 2012
how to get latest file
thru query
i.e
i have files in a directory
1130am.txt
11.45am.txt
1200am.txt
my query should return 1200am.txtOriginally posted by vrsrinivas
how to get the name of the latest file of a particular directory
thru query
i.e
i have files in a directory
1130am.txt
11.45am.txt
1200am.txt
my query should return 1200am.txt
Assuming that all your file names are prefixed with a time stamp then you should be able to use the MAX() function to return the desired record.
create table #test (theFileName varchar(20))
insert into #test (theFileName) values ('1130am.txt')
insert into #test (theFileName) values ('11.45am.txt')
insert into #test (theFileName) values ('1200am.txt')
select max(theFileName) from #test|||I'm thinking the hard part is getting the info from the directory...
Delete From Ledger_Folder
Insert Into Ledger_Folder exec master..xp_cmdshell 'Dir d:\Data\Tax\SmartStreamExtracts\*.*'
Delete From Ledger_Folder_Parsed
Insert Into Ledger_Folder_Parsed (Create_Time, File_Size, File_Name )
Select Convert(datetime,Substring(dir_output,1,8)
+ ' '
+ (Substring(dir_output,11,5)
+ Case When Substring(dir_output,16,1) = 'a' Then ' AM' Else ' PM' End)) As Create_Time
, Convert(Int,LTrim(RTrim(Replace(Substring(dir_outp ut,17,22),',','')))) As File_Size
, Substring(dir_output,40,(Len(dir_output)-39)) As File_Name
From Ledger_Folder
Where Substring(dir_output,1,1) <> ' '
And (Substring(dir_output,1,1) <> ' '
And Substring(dir_output,25,5) <> '<DIR>')