Hi Everybody,
I am trying to measure the difference in execution between the encrypted
version versus the non-encrypted version of a stored procedure. I found that
in some tries the encrypted version of the stored procedure takes less time
to execute than the unencrypted version!!! (I an using SQL Profiler and a
custom template to store the result in a table, which is on a different sql
server on a different machine).
Any thoughts on why this is happening would be highly appreciated.
Thanks.
Regards,
Soumitra BanerjeeI'm not aware of an reasons the encrypted proc should be any different.
There certainly could be reaons I'm not aware of though...
what types of performance differences are you seeing?
<<
I found that
> in some tries the encrypted version of the stored procedure takes less
time
> to execute than the unencrypted version!!!
needless to say... a proc isn't guaranteed to take the same amount of time
every time... are you sure there's a correlation in time based on whether
it's encrypted? Could it simply be that your proc takes different amounts of
time to run based on load on the server or the parameters you're passing in?
Brian Moran
Principal Mentor
Solid Quality Learning
SQL Server MVP
http://www.solidqualitylearning.com
"Soumitra Banerjee" <sbanerjee@.epacesoftware.com> wrote in message
news:%231sdZal%23DHA.2664@.TK2MSFTNGP09.phx.gbl...
> Hi Everybody,
> I am trying to measure the difference in execution between the encrypted
> version versus the non-encrypted version of a stored procedure. I found
that
> in some tries the encrypted version of the stored procedure takes less
time
> to execute than the unencrypted version!!! (I an using SQL Profiler and a
> custom template to store the result in a table, which is on a different
sql
> server on a different machine).
> Any thoughts on why this is happening would be highly appreciated.
> Thanks.
> Regards,
> Soumitra Banerjee
>|||Thanks for the mail. The result of my testing are as follows:
SQL Server was restarted before TRY 1 . After TRY 1 the same stored
procedure is executed 4 times and the time differences are noted using SQL
Profiler.
SET 1
Non Encrypted Version
Encrypted Version
TRY 1 4694
4589.4
TRY 2 635.2
406.2
TRY 3 330
346.2
TRY 4 534
589
TRY 5 357
303.2
SET 2
Non Encrypted Version
Encrypted Version
TRY 1 8439
8435
TRY 2 1350
956
TRY 3 944
856
TRY 4 1014
813
TRY 5 911
792
SET 3
Non Encrypted Version
Encrypted Version
TRY 1 8900
2800
TRY 2 1197
1356
TRY 3 1059
1033
TRY 4 764
1150
TRY 5 1095
1086
"Brian Moran" <brian@.solidqualitylearning.com> wrote in message
news:ubCjbjl#DHA.3232@.TK2MSFTNGP10.phx.gbl...
> I'm not aware of an reasons the encrypted proc should be any different.
> There certainly could be reaons I'm not aware of though...
> what types of performance differences are you seeing?
> <<
> I found that
> time
> needless to say... a proc isn't guaranteed to take the same amount of time
> every time... are you sure there's a correlation in time based on whether
> it's encrypted? Could it simply be that your proc takes different amounts
of
> time to run based on load on the server or the parameters you're passing
in?
> --
> Brian Moran
> Principal Mentor
> Solid Quality Learning
> SQL Server MVP
> http://www.solidqualitylearning.com
>
> "Soumitra Banerjee" <sbanerjee@.epacesoftware.com> wrote in message
> news:%231sdZal%23DHA.2664@.TK2MSFTNGP09.phx.gbl...
> that
> time
a
> sql
>|||Soumitra,
Are you using
DBCC FREEPROCCACHE
DBCC DROPCLEANBUFFERS
between executions, as well as exactly the same parameter set?
If not, you cannot expect similar results.
And, even if you are, you still cannot expect standardized results until
you're working in a sandbox.
Machine load variations are a huge factor.
James Hokes
"Soumitra Banerjee" <sbanerjee@.epacesoftware.com> wrote in message
news:%231sdZal%23DHA.2664@.TK2MSFTNGP09.phx.gbl...
> Hi Everybody,
> I am trying to measure the difference in execution between the encrypted
> version versus the non-encrypted version of a stored procedure. I found
that
> in some tries the encrypted version of the stored procedure takes less
time
> to execute than the unencrypted version!!! (I an using SQL Profiler and a
> custom template to store the result in a table, which is on a different
sql
> server on a different machine).
> Any thoughts on why this is happening would be highly appreciated.
> Thanks.
> Regards,
> Soumitra Banerjee
>
Showing posts with label procedure. Show all posts
Showing posts with label procedure. Show all posts
Wednesday, March 21, 2012
Measuring the duration of encrypted stored procedure
Hi Everybody,
I am trying to measure the difference in execution between the encrypted
version versus the non-encrypted version of a stored procedure. I found that
in some tries the encrypted version of the stored procedure takes less time
to execute than the unencrypted version!!! (I an using SQL Profiler and a
custom template to store the result in a table, which is on a different sql
server on a different machine).
Any thoughts on why this is happening would be highly appreciated.
Thanks.
Regards,
Soumitra BanerjeeI'm not aware of an reasons the encrypted proc should be any different.
There certainly could be reaons I'm not aware of though...
what types of performance differences are you seeing?
<<
I found that
> in some tries the encrypted version of the stored procedure takes less
time
> to execute than the unencrypted version!!!
needless to say... a proc isn't guaranteed to take the same amount of time
every time... are you sure there's a correlation in time based on whether
it's encrypted? Could it simply be that your proc takes different amounts of
time to run based on load on the server or the parameters you're passing in?
--
Brian Moran
Principal Mentor
Solid Quality Learning
SQL Server MVP
http://www.solidqualitylearning.com
"Soumitra Banerjee" <sbanerjee@.epacesoftware.com> wrote in message
news:%231sdZal%23DHA.2664@.TK2MSFTNGP09.phx.gbl...
> Hi Everybody,
> I am trying to measure the difference in execution between the encrypted
> version versus the non-encrypted version of a stored procedure. I found
that
> in some tries the encrypted version of the stored procedure takes less
time
> to execute than the unencrypted version!!! (I an using SQL Profiler and a
> custom template to store the result in a table, which is on a different
sql
> server on a different machine).
> Any thoughts on why this is happening would be highly appreciated.
> Thanks.
> Regards,
> Soumitra Banerjee
>|||Thanks for the mail. The result of my testing are as follows:
SQL Server was restarted before TRY 1 . After TRY 1 the same stored
procedure is executed 4 times and the time differences are noted using SQL
Profiler.
SET 1
Non Encrypted Version
Encrypted Version
TRY 1 4694
4589.4
TRY 2 635.2
406.2
TRY 3 330
346.2
TRY 4 534
589
TRY 5 357
303.2
SET 2
Non Encrypted Version
Encrypted Version
TRY 1 8439
8435
TRY 2 1350
956
TRY 3 944
856
TRY 4 1014
813
TRY 5 911
792
SET 3
Non Encrypted Version
Encrypted Version
TRY 1 8900
2800
TRY 2 1197
1356
TRY 3 1059
1033
TRY 4 764
1150
TRY 5 1095
1086
"Brian Moran" <brian@.solidqualitylearning.com> wrote in message
news:ubCjbjl#DHA.3232@.TK2MSFTNGP10.phx.gbl...
> I'm not aware of an reasons the encrypted proc should be any different.
> There certainly could be reaons I'm not aware of though...
> what types of performance differences are you seeing?
> <<
> I found that
> > in some tries the encrypted version of the stored procedure takes less
> time
> > to execute than the unencrypted version!!!
> >>
> needless to say... a proc isn't guaranteed to take the same amount of time
> every time... are you sure there's a correlation in time based on whether
> it's encrypted? Could it simply be that your proc takes different amounts
of
> time to run based on load on the server or the parameters you're passing
in?
> --
> Brian Moran
> Principal Mentor
> Solid Quality Learning
> SQL Server MVP
> http://www.solidqualitylearning.com
>
> "Soumitra Banerjee" <sbanerjee@.epacesoftware.com> wrote in message
> news:%231sdZal%23DHA.2664@.TK2MSFTNGP09.phx.gbl...
> > Hi Everybody,
> >
> > I am trying to measure the difference in execution between the encrypted
> > version versus the non-encrypted version of a stored procedure. I found
> that
> > in some tries the encrypted version of the stored procedure takes less
> time
> > to execute than the unencrypted version!!! (I an using SQL Profiler and
a
> > custom template to store the result in a table, which is on a different
> sql
> > server on a different machine).
> >
> > Any thoughts on why this is happening would be highly appreciated.
> >
> > Thanks.
> > Regards,
> >
> > Soumitra Banerjee
> >
> >
>|||Soumitra,
Are you using
DBCC FREEPROCCACHE
DBCC DROPCLEANBUFFERS
between executions, as well as exactly the same parameter set?
If not, you cannot expect similar results.
And, even if you are, you still cannot expect standardized results until
you're working in a sandbox.
Machine load variations are a huge factor.
James Hokes
"Soumitra Banerjee" <sbanerjee@.epacesoftware.com> wrote in message
news:%231sdZal%23DHA.2664@.TK2MSFTNGP09.phx.gbl...
> Hi Everybody,
> I am trying to measure the difference in execution between the encrypted
> version versus the non-encrypted version of a stored procedure. I found
that
> in some tries the encrypted version of the stored procedure takes less
time
> to execute than the unencrypted version!!! (I an using SQL Profiler and a
> custom template to store the result in a table, which is on a different
sql
> server on a different machine).
> Any thoughts on why this is happening would be highly appreciated.
> Thanks.
> Regards,
> Soumitra Banerjee
>
I am trying to measure the difference in execution between the encrypted
version versus the non-encrypted version of a stored procedure. I found that
in some tries the encrypted version of the stored procedure takes less time
to execute than the unencrypted version!!! (I an using SQL Profiler and a
custom template to store the result in a table, which is on a different sql
server on a different machine).
Any thoughts on why this is happening would be highly appreciated.
Thanks.
Regards,
Soumitra BanerjeeI'm not aware of an reasons the encrypted proc should be any different.
There certainly could be reaons I'm not aware of though...
what types of performance differences are you seeing?
<<
I found that
> in some tries the encrypted version of the stored procedure takes less
time
> to execute than the unencrypted version!!!
needless to say... a proc isn't guaranteed to take the same amount of time
every time... are you sure there's a correlation in time based on whether
it's encrypted? Could it simply be that your proc takes different amounts of
time to run based on load on the server or the parameters you're passing in?
--
Brian Moran
Principal Mentor
Solid Quality Learning
SQL Server MVP
http://www.solidqualitylearning.com
"Soumitra Banerjee" <sbanerjee@.epacesoftware.com> wrote in message
news:%231sdZal%23DHA.2664@.TK2MSFTNGP09.phx.gbl...
> Hi Everybody,
> I am trying to measure the difference in execution between the encrypted
> version versus the non-encrypted version of a stored procedure. I found
that
> in some tries the encrypted version of the stored procedure takes less
time
> to execute than the unencrypted version!!! (I an using SQL Profiler and a
> custom template to store the result in a table, which is on a different
sql
> server on a different machine).
> Any thoughts on why this is happening would be highly appreciated.
> Thanks.
> Regards,
> Soumitra Banerjee
>|||Thanks for the mail. The result of my testing are as follows:
SQL Server was restarted before TRY 1 . After TRY 1 the same stored
procedure is executed 4 times and the time differences are noted using SQL
Profiler.
SET 1
Non Encrypted Version
Encrypted Version
TRY 1 4694
4589.4
TRY 2 635.2
406.2
TRY 3 330
346.2
TRY 4 534
589
TRY 5 357
303.2
SET 2
Non Encrypted Version
Encrypted Version
TRY 1 8439
8435
TRY 2 1350
956
TRY 3 944
856
TRY 4 1014
813
TRY 5 911
792
SET 3
Non Encrypted Version
Encrypted Version
TRY 1 8900
2800
TRY 2 1197
1356
TRY 3 1059
1033
TRY 4 764
1150
TRY 5 1095
1086
"Brian Moran" <brian@.solidqualitylearning.com> wrote in message
news:ubCjbjl#DHA.3232@.TK2MSFTNGP10.phx.gbl...
> I'm not aware of an reasons the encrypted proc should be any different.
> There certainly could be reaons I'm not aware of though...
> what types of performance differences are you seeing?
> <<
> I found that
> > in some tries the encrypted version of the stored procedure takes less
> time
> > to execute than the unencrypted version!!!
> >>
> needless to say... a proc isn't guaranteed to take the same amount of time
> every time... are you sure there's a correlation in time based on whether
> it's encrypted? Could it simply be that your proc takes different amounts
of
> time to run based on load on the server or the parameters you're passing
in?
> --
> Brian Moran
> Principal Mentor
> Solid Quality Learning
> SQL Server MVP
> http://www.solidqualitylearning.com
>
> "Soumitra Banerjee" <sbanerjee@.epacesoftware.com> wrote in message
> news:%231sdZal%23DHA.2664@.TK2MSFTNGP09.phx.gbl...
> > Hi Everybody,
> >
> > I am trying to measure the difference in execution between the encrypted
> > version versus the non-encrypted version of a stored procedure. I found
> that
> > in some tries the encrypted version of the stored procedure takes less
> time
> > to execute than the unencrypted version!!! (I an using SQL Profiler and
a
> > custom template to store the result in a table, which is on a different
> sql
> > server on a different machine).
> >
> > Any thoughts on why this is happening would be highly appreciated.
> >
> > Thanks.
> > Regards,
> >
> > Soumitra Banerjee
> >
> >
>|||Soumitra,
Are you using
DBCC FREEPROCCACHE
DBCC DROPCLEANBUFFERS
between executions, as well as exactly the same parameter set?
If not, you cannot expect similar results.
And, even if you are, you still cannot expect standardized results until
you're working in a sandbox.
Machine load variations are a huge factor.
James Hokes
"Soumitra Banerjee" <sbanerjee@.epacesoftware.com> wrote in message
news:%231sdZal%23DHA.2664@.TK2MSFTNGP09.phx.gbl...
> Hi Everybody,
> I am trying to measure the difference in execution between the encrypted
> version versus the non-encrypted version of a stored procedure. I found
that
> in some tries the encrypted version of the stored procedure takes less
time
> to execute than the unencrypted version!!! (I an using SQL Profiler and a
> custom template to store the result in a table, which is on a different
sql
> server on a different machine).
> Any thoughts on why this is happening would be highly appreciated.
> Thanks.
> Regards,
> Soumitra Banerjee
>
Measuring serve uptime
I am trying to create a report which gives total time
between SQL server start up and shut down. I have created
a stored procedure which runs at server startup and
inserts date and time into a table.Is there some way I can
find the server shutdown time as well.
Thanks,
AnoopCheck the SQL log files.
"Anoop Agarwal" <agarwala@.halcrow.com> wrote in message
news:0a9701c37cfb$8d29d3b0$a301280a@.phx.gbl...
> I am trying to create a report which gives total time
> between SQL server start up and shut down. I have created
> a stored procedure which runs at server startup and
> inserts date and time into a table.Is there some way I can
> find the server shutdown time as well.
> Thanks,
> Anoop|||You can parse the SQL Server log files (not to be confused with the
transaction log files). They are plain text files called ERRORLOG you can
find in the LOG directory of your SQL Server installation. The first line
will give you the server start up time and the last line the server shut
down time.
--
Jacco Schalkwijk MCDBA, MCSD, MCSE
Database Administrator
Eurostop Ltd.
"Anoop Agarwal" <agarwala@.halcrow.com> wrote in message
news:0a9701c37cfb$8d29d3b0$a301280a@.phx.gbl...
> I am trying to create a report which gives total time
> between SQL server start up and shut down. I have created
> a stored procedure which runs at server startup and
> inserts date and time into a table.Is there some way I can
> find the server shutdown time as well.
> Thanks,
> Anoop|||The more I think about it the ErrorLog can't be relied upon. Someone could
have issued sp_cycle_errorlog and manually started a new errorlog.
There is an NT Event written to the EventLog when SQL Stops
17147 :
SQL Server terminating because of system shutdown.
If you could read this informatrion it would be more reliable. I know of a
proc called sp_eventlog but don't know how it works
HTH
Ryan Waight, MCDBA, MCSE
"Ryan Waight" <Ryan_Waight@.nospam.hotmail.com> wrote in message
news:uPLlelQfDHA.944@.TK2MSFTNGP11.phx.gbl...
> TempDB is created each time SQL starts by default. The following code will
> give you the time SQL Started :- select crdate from sysdatabases where
name
> = 'TempDB'
> To establish when SQL was stopped you could try sp_readerrorlog 1 - this
> will show you previous error log, the max time in this file is SQL
shutting
> down
> --
> HTH
> Ryan Waight, MCDBA, MCSE
> "Anoop Agarwal" <agarwala@.halcrow.com> wrote in message
> news:0a9701c37cfb$8d29d3b0$a301280a@.phx.gbl...
> > I am trying to create a report which gives total time
> > between SQL server start up and shut down. I have created
> > a stored procedure which runs at server startup and
> > inserts date and time into a table.Is there some way I can
> > find the server shutdown time as well.
> >
> > Thanks,
> >
> > Anoop
>|||Check the SQLagent.out file?
>--Original Message--
>I am trying to create a report which gives total time
>between SQL server start up and shut down. I have
created
>a stored procedure which runs at server startup and
>inserts date and time into a table.Is there some way I
can
>find the server shutdown time as well.
>Thanks,
>Anoop
>.
>|||Check the SQLagent.out file?
>--Original Message--
>I am trying to create a report which gives total time
>between SQL server start up and shut down. I have
created
>a stored procedure which runs at server startup and
>inserts date and time into a table.Is there some way I
can
>find the server shutdown time as well.
>Thanks,
>Anoop
>.
>sql
between SQL server start up and shut down. I have created
a stored procedure which runs at server startup and
inserts date and time into a table.Is there some way I can
find the server shutdown time as well.
Thanks,
AnoopCheck the SQL log files.
"Anoop Agarwal" <agarwala@.halcrow.com> wrote in message
news:0a9701c37cfb$8d29d3b0$a301280a@.phx.gbl...
> I am trying to create a report which gives total time
> between SQL server start up and shut down. I have created
> a stored procedure which runs at server startup and
> inserts date and time into a table.Is there some way I can
> find the server shutdown time as well.
> Thanks,
> Anoop|||You can parse the SQL Server log files (not to be confused with the
transaction log files). They are plain text files called ERRORLOG you can
find in the LOG directory of your SQL Server installation. The first line
will give you the server start up time and the last line the server shut
down time.
--
Jacco Schalkwijk MCDBA, MCSD, MCSE
Database Administrator
Eurostop Ltd.
"Anoop Agarwal" <agarwala@.halcrow.com> wrote in message
news:0a9701c37cfb$8d29d3b0$a301280a@.phx.gbl...
> I am trying to create a report which gives total time
> between SQL server start up and shut down. I have created
> a stored procedure which runs at server startup and
> inserts date and time into a table.Is there some way I can
> find the server shutdown time as well.
> Thanks,
> Anoop|||The more I think about it the ErrorLog can't be relied upon. Someone could
have issued sp_cycle_errorlog and manually started a new errorlog.
There is an NT Event written to the EventLog when SQL Stops
17147 :
SQL Server terminating because of system shutdown.
If you could read this informatrion it would be more reliable. I know of a
proc called sp_eventlog but don't know how it works
HTH
Ryan Waight, MCDBA, MCSE
"Ryan Waight" <Ryan_Waight@.nospam.hotmail.com> wrote in message
news:uPLlelQfDHA.944@.TK2MSFTNGP11.phx.gbl...
> TempDB is created each time SQL starts by default. The following code will
> give you the time SQL Started :- select crdate from sysdatabases where
name
> = 'TempDB'
> To establish when SQL was stopped you could try sp_readerrorlog 1 - this
> will show you previous error log, the max time in this file is SQL
shutting
> down
> --
> HTH
> Ryan Waight, MCDBA, MCSE
> "Anoop Agarwal" <agarwala@.halcrow.com> wrote in message
> news:0a9701c37cfb$8d29d3b0$a301280a@.phx.gbl...
> > I am trying to create a report which gives total time
> > between SQL server start up and shut down. I have created
> > a stored procedure which runs at server startup and
> > inserts date and time into a table.Is there some way I can
> > find the server shutdown time as well.
> >
> > Thanks,
> >
> > Anoop
>|||Check the SQLagent.out file?
>--Original Message--
>I am trying to create a report which gives total time
>between SQL server start up and shut down. I have
created
>a stored procedure which runs at server startup and
>inserts date and time into a table.Is there some way I
can
>find the server shutdown time as well.
>Thanks,
>Anoop
>.
>|||Check the SQLagent.out file?
>--Original Message--
>I am trying to create a report which gives total time
>between SQL server start up and shut down. I have
created
>a stored procedure which runs at server startup and
>inserts date and time into a table.Is there some way I
can
>find the server shutdown time as well.
>Thanks,
>Anoop
>.
>sql
Saturday, February 25, 2012
MDX Query above 8000 characters
Hi,
I have a MDX query which is of an aprox length of 10000 characters. I
have to execute the query from within the stored procedure in sql. To
run this query I use the openrowset method.
If the length of my query is less than 8000 characters my query
executes perfectly, but the moment it exceeds 8000 characters it stop
working. Please suggest a solution for the same.
Sample Code:
declare @.mdxqry varchar(8000)
declare @.SearchCond varchar(8000)
set @.SearchCond = @.SearchCond + '
[ProductsAccounts].CurrentMember.properties("AS Date") <= "' + @.TDate
+ '" '
set @.mdxqry = '''WITH ' +
'MEMBER [Measures].[Difference] as ''''[Measures].[Expected Interest
Amount] - [Measures].[Adjusted Interest]'''' ' +
'MEMBER [Measures].[Loan Closed within Report Period] as ' +
''iif(cdate([ProductsAccounts].CurrentMember.properties("Closed
Date")) < cdate("' + @.ToDate + '"), "Yes", "No")'' +
'MEMBER [Measures].[ClosedBeforeLastInstallment] as
''''iif([Measures].[Loan Closed Before Last Instal]=1, "Yes", "No")''''
' +
'SELECT ' +
'{[Measures].[Expected Interest Amount], [Measures].[Adjusted
Interest], [Measures].[Difference], ' +
'[Measures].[Zero Interest Transactions],
[Measures].[ClosedBeforeLastInstallment], ' +
'[Measures].[Loan Closed within Report Period]} ON 0, '
set @.mdxqry = @.mdxqry +
'{Filter([ProductsAccounts].[Account Id].Members, (' + @.SearchCond +
'))} on 2, ' +
@.BranchFilter +
'FROM InterestAnalysis'''
set @.mdxqry = 'SELECT a.* FROM
OpenRowset(''MSOLAP'',''DATASOURCE="SERVERNAME"; Initial
Catalog="DATABASENAME";'',' + @.mdxqry + ') as a'
exec(@.mdxqry)
I have already tried splitting my query into smalled chunks and
executing it, but still I face the same problem.
This is how I have Done it:
declare @.mdxqry1 varchar(8000)
declare @.mdxqry2 varchar(8000)
declare @.SearchCond varchar(8000)
set @.SearchCond = @.SearchCond + '
[ProductsAccounts].CurrentMember.properties("AS Date") <= "' + @.TDate
+ '" '
set @.mdxqry1 = '''WITH ' +
'MEMBER [Measures].[Difference] as ''''[Measures].[Expected Interest
Amount] - [Measures].[Adjusted Interest]'''' ' +
'MEMBER [Measures].[Loan Closed within Report Period] as ' +
''iif(cdate([ProductsAccounts].CurrentMember.properties("Closed
Date")) < cdate("' + @.ToDate + '"), "Yes", "No")'' +
'MEMBER [Measures].[ClosedBeforeLastInstallment] as
''''iif([Measures].[Loan Closed Before Last Instal]=1, "Yes", "No")''''
'
set @.mdxqry2 = 'SELECT ' +
'{[Measures].[Expected Interest Amount], [Measures].[Adjusted
Interest], [Measures].[Difference], ' +
'[Measures].[Zero Interest Transactions],
[Measures].[ClosedBeforeLastInstallment], ' +
'[Measures].[Loan Closed within Report Period]} ON 0, '
set @.mdxqry2 = @.mdxqry2 +
'{Filter([ProductsAccounts].[Account Id].Members, (' + @.SearchCond +
'))} on 2, ' +
@.BranchFilter +
'FROM InterestAnalysis'''
set @.mdxqry2 = 'SELECT a.* FROM
OpenRowset(''MSOLAP'',''DATASOURCE="SERVERNAME"; Initial
Catalog="DATABASENAME";'',' + @.mdxqry + ') as a'
exec(@.mdxqry1 + @.mdxqry2)
Thanks in Advance
Charuvarchar is limited to 8000 characters, but EXEC can take several varchar parameters concatenated together.
Try breaking @.mdxqry into several strings that you know will be below the 8k limit (@.mdxqry1, @.mdxqry2, ...@.mdxqryN). Then call it like this:
exec (@.mdxqry1 + @.mdxqry2 + ... @.mdxqryN)|||I have already tried breaking up the varchar into multiple variables but the same problem exists...Please see if there is any other solution...
Thanks
Charu|||I have already tried breaking up the varchar into multiple variables but the same problem exists...How? Not according to the code you posted.
I have a MDX query which is of an aprox length of 10000 characters. I
have to execute the query from within the stored procedure in sql. To
run this query I use the openrowset method.
If the length of my query is less than 8000 characters my query
executes perfectly, but the moment it exceeds 8000 characters it stop
working. Please suggest a solution for the same.
Sample Code:
declare @.mdxqry varchar(8000)
declare @.SearchCond varchar(8000)
set @.SearchCond = @.SearchCond + '
[ProductsAccounts].CurrentMember.properties("AS Date") <= "' + @.TDate
+ '" '
set @.mdxqry = '''WITH ' +
'MEMBER [Measures].[Difference] as ''''[Measures].[Expected Interest
Amount] - [Measures].[Adjusted Interest]'''' ' +
'MEMBER [Measures].[Loan Closed within Report Period] as ' +
''iif(cdate([ProductsAccounts].CurrentMember.properties("Closed
Date")) < cdate("' + @.ToDate + '"), "Yes", "No")'' +
'MEMBER [Measures].[ClosedBeforeLastInstallment] as
''''iif([Measures].[Loan Closed Before Last Instal]=1, "Yes", "No")''''
' +
'SELECT ' +
'{[Measures].[Expected Interest Amount], [Measures].[Adjusted
Interest], [Measures].[Difference], ' +
'[Measures].[Zero Interest Transactions],
[Measures].[ClosedBeforeLastInstallment], ' +
'[Measures].[Loan Closed within Report Period]} ON 0, '
set @.mdxqry = @.mdxqry +
'{Filter([ProductsAccounts].[Account Id].Members, (' + @.SearchCond +
'))} on 2, ' +
@.BranchFilter +
'FROM InterestAnalysis'''
set @.mdxqry = 'SELECT a.* FROM
OpenRowset(''MSOLAP'',''DATASOURCE="SERVERNAME"; Initial
Catalog="DATABASENAME";'',' + @.mdxqry + ') as a'
exec(@.mdxqry)
I have already tried splitting my query into smalled chunks and
executing it, but still I face the same problem.
This is how I have Done it:
declare @.mdxqry1 varchar(8000)
declare @.mdxqry2 varchar(8000)
declare @.SearchCond varchar(8000)
set @.SearchCond = @.SearchCond + '
[ProductsAccounts].CurrentMember.properties("AS Date") <= "' + @.TDate
+ '" '
set @.mdxqry1 = '''WITH ' +
'MEMBER [Measures].[Difference] as ''''[Measures].[Expected Interest
Amount] - [Measures].[Adjusted Interest]'''' ' +
'MEMBER [Measures].[Loan Closed within Report Period] as ' +
''iif(cdate([ProductsAccounts].CurrentMember.properties("Closed
Date")) < cdate("' + @.ToDate + '"), "Yes", "No")'' +
'MEMBER [Measures].[ClosedBeforeLastInstallment] as
''''iif([Measures].[Loan Closed Before Last Instal]=1, "Yes", "No")''''
'
set @.mdxqry2 = 'SELECT ' +
'{[Measures].[Expected Interest Amount], [Measures].[Adjusted
Interest], [Measures].[Difference], ' +
'[Measures].[Zero Interest Transactions],
[Measures].[ClosedBeforeLastInstallment], ' +
'[Measures].[Loan Closed within Report Period]} ON 0, '
set @.mdxqry2 = @.mdxqry2 +
'{Filter([ProductsAccounts].[Account Id].Members, (' + @.SearchCond +
'))} on 2, ' +
@.BranchFilter +
'FROM InterestAnalysis'''
set @.mdxqry2 = 'SELECT a.* FROM
OpenRowset(''MSOLAP'',''DATASOURCE="SERVERNAME"; Initial
Catalog="DATABASENAME";'',' + @.mdxqry + ') as a'
exec(@.mdxqry1 + @.mdxqry2)
Thanks in Advance
Charuvarchar is limited to 8000 characters, but EXEC can take several varchar parameters concatenated together.
Try breaking @.mdxqry into several strings that you know will be below the 8k limit (@.mdxqry1, @.mdxqry2, ...@.mdxqryN). Then call it like this:
exec (@.mdxqry1 + @.mdxqry2 + ... @.mdxqryN)|||I have already tried breaking up the varchar into multiple variables but the same problem exists...Please see if there is any other solution...
Thanks
Charu|||I have already tried breaking up the varchar into multiple variables but the same problem exists...How? Not according to the code you posted.
Subscribe to:
Posts (Atom)