Showing posts with label run. Show all posts
Showing posts with label run. Show all posts

Tuesday, March 27, 2012

Customize Prompt Message for Stored Procudure

Hello all,
I have a stored procedure that prompts the user for beginning date and
ending date to run a monthly report. The prompt says
Enter_Beginning_Date and Enter_Ending_Date. I want the prompt to say
Enter Beginning Date (Example:1-1-2003) or something like that. Is
there a way to do this?

CREATE PROCEDURE dbo.MonthlyReport(@.Enter_Beginning_Date datetime,
@.Enter_Ending_Date datetime)
AS SELECT incident, @.Enter_Beginning_Date AS BeginningDate,
@.Enter_Ending_Date AS EndingDate, COUNT(*) AS Occurances
FROM dbo.Incident
WHERE (DateOccured BETWEEN @.Enter_Beginning_Date AND
@.Enter_Ending_Date)
GROUP BY incident
GO"ndn_24_7" <ndn_24_7@.yahoo.com> wrote in message
news:1105983132.532065.27990@.c13g2000cwb.googlegro ups.com...
> Hello all,
> I have a stored procedure that prompts the user for beginning date and
> ending date to run a monthly report. The prompt says
> Enter_Beginning_Date and Enter_Ending_Date. I want the prompt to say
> Enter Beginning Date (Example:1-1-2003) or something like that. Is
> there a way to do this?
> CREATE PROCEDURE dbo.MonthlyReport(@.Enter_Beginning_Date datetime,
> @.Enter_Ending_Date datetime)
> AS SELECT incident, @.Enter_Beginning_Date AS BeginningDate,
> @.Enter_Ending_Date AS EndingDate, COUNT(*) AS Occurances
> FROM dbo.Incident
> WHERE (DateOccured BETWEEN @.Enter_Beginning_Date AND
> @.Enter_Ending_Date)
> GROUP BY incident
> GO

MSSQL is purely a server, so it doesn't have any idea about GUIs or
prompts - if you want to present a more user-friendly description of the two
parameters, then you would have to do that in the front-end application
where the users select the dates.

One possible approach would be to add an extended property to the two
parameters which has the description in it, then retrieve that from the
front end when you display the input screen. See "Using Extended Properties
on Database Objects" in Books Online for more details. But I don't know if
that would be a suitable solution for your toolset and design.

Simon|||I'm sorry
I should have been more discriptive. My program has a Access 2000 front
end and a SQL 2000 server backend. I have a button that the user clicks
that brings up the prompt window for the stored proc. So would I do
this on the Access front end, Where would Icustomize this message?|||Not a clue how you are prompting the user thru Stored Procedure. May be
you missed out some valuable info on the post........!|||ndn_24_7 (ndn_24_7@.yahoo.com) writes:
> I should have been more discriptive. My program has a Access 2000 front
> end and a SQL 2000 server backend. I have a button that the user clicks
> that brings up the prompt window for the stored proc. So would I do
> this on the Access front end, Where would Icustomize this message?

Sounds like you should try an Access newsgroup. It is possible that
you can use extended properties for this, but I have no knowledge
what Access makes use of. So try comp.databases.ms-access where the
expertise for this question might hang out.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||As far I understood,

You have a stored procedure that accepts parameters and you have an
Access front end that accepts input parameters thru prompts and pass
them to the backend stored procedure... Am I correct?

If so, what you are doing is correct so far. You need to find out how
to call a stored procedure thru access and once you know, all you need
to do is, thru access, get those inputs (you may display anyway you
need - that is irrelevent to the backend procedure...) and pass them as
parameters to the backend stored proc.. May be an access guru can show
some light on how to accomplish this..!|||"ndn_24_7" <ndn_24_7@.yahoo.com> wrote in message
news:1105990021.951317.205140@.c13g2000cwb.googlegr oups.com...
> I'm sorry
> I should have been more discriptive. My program has a Access 2000 front
> end and a SQL 2000 server backend. I have a button that the user clicks
> that brings up the prompt window for the stored proc. So would I do
> this on the Access front end, Where would Icustomize this message?

I suggest you want a form that the user enters the dates in and then clicks
the button to run the stored proc.
I'll assume you know a little about VB code.
Otherwise, you got a steep learning curve ahead mate.

You probably want to validate the fields using isdate()

Access now uses ADO, so the code involves using an ado connection and
command.
I found pretty much the below code by using google to search the access
newsgroup.
Not tested it and I had to add the execute line, so this is just to get you
started.
BTW You'll want to get used to doing such searches if you are new to this
lark.
I suggest also take a look at each of the bits in turn and read up using
msdn so you get a better understanding what you're up to.
I have deliberately not changed the parameter type to date and input because
you'd learn stuff all if I just gave you the code.

There's a couple gotchas with datetime. Inside access some bits want this
delimited by # but not with ado. Remember also the time bit of a date is
likely there. Not such a problem with > or < but throw that to the back of
your mind for later.

Anyhow.
You run the thing by using the execute method of the command.
There's a parameter collection associated with a command you add the values
to:

'start untested snippet
Dim cmd As ADODB.Command
Dim prm As ADODB.Parameter

Set cmd = New ADODB.Command
cmd.ActiveConnection = CurrentProject.Connection
cmd.CommandText = "stored procedurename"
cmd.CommandType = adCmdStoredProc
Set prm = cmd.CreateParameter("@.CompanyID", adInteger, adParamOutput _
, , forms!yourformname!text1.Value)
cmd.Parameters.Append prm

cmd.execute

set prm = Nothing
Set cmd = Nothing

' end snippet

HTH

--
Regards,
Andy O'Neill

Thursday, March 22, 2012

custom summary reports in mgmt studio

Is it possible to create custom summary reports and run them in management studio? I am assuming these reports are RS reports.

thanks,

Derek

Is it possible to create custom summary reports and run them in management studio?

Doubt if there is such feature.

I am assuming these reports are RS reports

SSMS installation doesn't require RS installation, so probably it's wrong assumption.

|||

This is not possible. Though this is something we're investigating for SP2. I suggest you vote on the following item in the Product Feedback Center: http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=fb83d75b-424a-4c72-a735-30692a077e57

Cheers,
Dan

Tuesday, March 20, 2012

Custom Security Extension issue...

I have tried to write a custom security extension. When I run the report
manager I get ...
Object Reference is not set to an instance of an object.
It's breaking in GlobalApp.Application_AuthenticationRequest
I figure its because it can't find my extension but I have the correct Url
in the securityextensioncodegroup. Could it be the type attibute in the
extension tag?
Type="RSSecurity.AuthorizationExtension,AuthorizationExtension"You may be getting the exception in the GetWebRequest override in the
derived ReportingService class because the HttpContext.Current.Request is
null which causes the call to the AuthCookie property to fail. I'm having a
similar problem that I'm working through right now. Maybe this will give you
some place to start looking for the problem.
Just a thought...
Garry
"Tad" <Tad@.discussions.microsoft.com> wrote in message
news:CF04B8C0-641A-4D50-9A90-B49625266D90@.microsoft.com...
> I have tried to write a custom security extension. When I run the report
> manager I get ...
> Object Reference is not set to an instance of an object.
> It's breaking in GlobalApp.Application_AuthenticationRequest
> I figure its because it can't find my extension but I have the correct Url
> in the securityextensioncodegroup. Could it be the type attibute in the
> extension tag?
> Type="RSSecurity.AuthorizationExtension,AuthorizationExtension"|||Gary,
Have you found a solution to this issue of the
HttpContext.Current.Request being null or found more information on
what might cause this to be null?
- Jessica
Garry Lenz wrote:
> You may be getting the exception in the GetWebRequest override in the
> derived ReportingService class because the
HttpContext.Current.Request is
> null which causes the call to the AuthCookie property to fail. I'm
having a
> similar problem that I'm working through right now. Maybe this will
give you
> some place to start looking for the problem.
> Just a thought...
> Garry
>
> "Tad" <Tad@.discussions.microsoft.com> wrote in message
> news:CF04B8C0-641A-4D50-9A90-B49625266D90@.microsoft.com...
> > I have tried to write a custom security extension. When I run the
report
> > manager I get ...
> >
> > Object Reference is not set to an instance of an object.
> >
> > It's breaking in GlobalApp.Application_AuthenticationRequest
> >
> > I figure its because it can't find my extension but I have the
correct Url
> > in the securityextensioncodegroup. Could it be the type attibute
in the
> > extension tag?
> >
> > Type="RSSecurity.AuthorizationExtension,AuthorizationExtension"|||This looks familiar. It could be one of a myriad of things. In our case,
the custom security extension called a web service, and there was an invalid
type definition in the web reference. We had to delete all our binaries and
web references from the development environment, reattach the web references
and recompile. Then it worked.
I hope that points you in the right direction. Bottom line issue: don't
lose your cookies.
--
Cheers,
'(' Jeff A. Stucker
\
Business Intelligence
www.criadvantage.com
---
<Jessica.Landisman@.ndchealth.com> wrote in message
news:1105364285.978877.33130@.c13g2000cwb.googlegroups.com...
> Gary,
> Have you found a solution to this issue of the
> HttpContext.Current.Request being null or found more information on
> what might cause this to be null?
> - Jessica
> Garry Lenz wrote:
>> You may be getting the exception in the GetWebRequest override in the
>> derived ReportingService class because the
> HttpContext.Current.Request is
>> null which causes the call to the AuthCookie property to fail. I'm
> having a
>> similar problem that I'm working through right now. Maybe this will
> give you
>> some place to start looking for the problem.
>> Just a thought...
>> Garry
>>
>> "Tad" <Tad@.discussions.microsoft.com> wrote in message
>> news:CF04B8C0-641A-4D50-9A90-B49625266D90@.microsoft.com...
>> > I have tried to write a custom security extension. When I run the
> report
>> > manager I get ...
>> >
>> > Object Reference is not set to an instance of an object.
>> >
>> > It's breaking in GlobalApp.Application_AuthenticationRequest
>> >
>> > I figure its because it can't find my extension but I have the
> correct Url
>> > in the securityextensioncodegroup. Could it be the type attibute
> in the
>> > extension tag?
>> >
>> > Type="RSSecurity.AuthorizationExtension,AuthorizationExtension"
>sql

Thursday, March 8, 2012

Custom function with multiple variables

Hello,
I must say I am not too experienced in writing custom functions in
TSQL. Perhaps I am asking impossible
I have run into problems that the client platform is not able to
transmit the unicode characters properly, so I need a solution that
woul allow to call insert/update queries with ASCII charset only. The
current solution is that every unicode string literal is replaced with
a long sum of NCHAR(n) and string literals containing only ASCII chars.
That made me run into some wierd 'query optimisation' error.
I am now thinking maybe I could create a function where I could pass
all the unicode code values and string literals and what would
concatenate all them into one string. So, the question is -
1) Is it possible to create a function with variable number of
arguments
2) Can these arguments be of different types - mixed integer and string
3) Is TSQL strong enough to provide means of creating program that
loops over all the arguments and concatenates all of them into one
string, converting the int arguments uzing NCHAR() function.
Example:
MyFn(256,1000,'ABC',300,400,'1234')
returns ''ABC?' (The funny unicode chars replaced with ? for the
sake of example)
Thank you for any hints,
Pavils> 1) Is it possible to create a function with variable number of arguments ?
No. The number of arguments is defined when you create the function.
Even if you specify default values for some arguments, when you call
the UDF you must specify the DEFAULT keyword in the place of the values
for those arguments.

> 2) Can these arguments be of different types - mixed integer and string ?
No, but in SQL Server 2000 (or later) you can use the sql_variant
datatype, which can represent any other scalar datatype (except text,
ntext, image and timestamp).

> 3) Is TSQL strong enough to [...] ?
Maybe, but I don't think that would be a good idea.
You should think about another way of dealing with this issue.
Razvan

Wednesday, March 7, 2012

Custom Editor

Hi,

If I implement a custom editor by inheriting from UITypeEditor, Can I invoke it at RUN TIME from a standard control other than PropertyGrid, say a comboBox or a button ?

If it is possible, could you please let me know how to do it or could you please direct me to some URL which shows how to do it.

Do I have to create a custom control that inherits from control for doing this ?

Thank you.

regards.
S

UITypeEditors are for extending design-time support in the property grid only. So they can be used within the VS studio property grid on tasks and components, or within your custom UI if that uses a property grid. I assume you are asking this in the context of a SSIS component or task and providing improved designer support or a custom UI.

Custom data processing logic

We are developing a web application that has to do a significant amount of
data processing before a report can be run. Please would someone advise me as
to the best place to put this custom data processing logic. Should I do it in
my app beforehand or is there an appropriate hook in the report processing
lifecycle?
Further info:
- The processing involves copying data to snapshot tables and then
enriching this data: the processing is complex and varies depending on the
user.
- We will use security extensions for Forms authentication and custom
authorization.
- We would like the user to be able to use the drill-down feature so would
want to use the web-based Report Viewer.
Any help would be greatly appreciated.
StuHello Stu,
Based on my experience, I suggest you to process your data first when your
user login or just after the login process.
After that, you could show the report.
My suggestion of the report view control is that you use the local report
in your application so that the report will use your custom authentication
and you do not need to customize the authentication in the report server.
All this is to avoid the slow performance of the report to the user.
Please let me know if you have any question.
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||Since it is a complex processing and moreover you have developed a web
application, do it in your application and get the final results to be
displayed, that will be faster, so RS will be used for reporting the end
results. Why the processing in your custom applications is that you get very
good flexibility like massaging the data, and filtering as per the user
etc... Finally the reporting part with layout, format, drilldown etc..can be
done using RS.
Amarnath, MCTS.
"Stu" wrote:
> We are developing a web application that has to do a significant amount of
> data processing before a report can be run. Please would someone advise me as
> to the best place to put this custom data processing logic. Should I do it in
> my app beforehand or is there an appropriate hook in the report processing
> lifecycle?
> Further info:
> - The processing involves copying data to snapshot tables and then
> enriching this data: the processing is complex and varies depending on the
> user.
> - We will use security extensions for Forms authentication and custom
> authorization.
> - We would like the user to be able to use the drill-down feature so would
> want to use the web-based Report Viewer.
> Any help would be greatly appreciated.
> Stu|||Thanks. I will look into using the report viewer control.
"Wei Lu [MSFT]" wrote:
> Hello Stu,
> Based on my experience, I suggest you to process your data first when your
> user login or just after the login process.
> After that, you could show the report.
> My suggestion of the report view control is that you use the local report
> in your application so that the report will use your custom authentication
> and you do not need to customize the authentication in the report server.
> All this is to avoid the slow performance of the report to the user.
> Please let me know if you have any question.
> Sincerely,
> Wei Lu
> Microsoft Online Community Support
> ==================================================> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================> This posting is provided "AS IS" with no warranties, and confers no rights.
>|||Hello Stu,
Thanks for the update. If you have any question , please feel free to let
me know.
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.

Friday, February 17, 2012

Custom Assembly #Error For Repoting Services 2005

Hi,
I have written an simple class in C# code for retrieving data from SQL 2005,
I could not solve the problem at run time (showed #Error) although I have :-
a) Include the assert statement as below :-
System.Data.SqlClient.SqlClientPermission oPerm = new
System.Data.SqlClient.SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted);
oPerm.Assert();
b) Adding code group as below :-
<CodeGroup
class="UnionCodeGroup" version="1" PermissionSetName="FullTrust" Name="Copy
of TestCodeGroup" Description="Why didn't
work?"> <IMembershipCondition
class="UrlMembershipCondition" version="1.0.0.0" Url="C:\Program
Files\Microsoft SQL Server\MSSQL.4\Reporting
Services\ReportServer\bin\prj_RptLib.dll" />
</CodeGroup>
I tried the position of the code group, created strong name but still could
not make get the problem solved.
I really appreciate if anyone could help to provide any information or
solution.
Regards,Hi,
Do you deploy to a Windows 2003 Server? Then try to use SQL-Server
Authentication. This worked for us. No idea why Integrated Security only
worked on XP.
Regards,
"chlow" <chlow@.discussions.microsoft.com> schrieb im Newsbeitrag
news:EE2DC3D3-1FCF-4A00-9FBF-585B83651EDD@.microsoft.com...
> Hi,
> I have written an simple class in C# code for retrieving data from SQL
> 2005,
> I could not solve the problem at run time (showed #Error) although I have
> :-
> a) Include the assert statement as below :-
> System.Data.SqlClient.SqlClientPermission oPerm = new
> System.Data.SqlClient.SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted);
> oPerm.Assert();
> b) Adding code group as below :-
> <CodeGroup
> class="UnionCodeGroup" version="1" PermissionSetName="FullTrust"
> Name="Copy
> of TestCodeGroup" Description="Why didn't
> work?"> <IMembershipCondition
> class="UrlMembershipCondition" version="1.0.0.0" Url="C:\Program
> Files\Microsoft SQL Server\MSSQL.4\Reporting
> Services\ReportServer\bin\prj_RptLib.dll" />
> </CodeGroup>
> I tried the position of the code group, created strong name but still
> could
> not make get the problem solved.
> I really appreciate if anyone could help to provide any information or
> solution.
> Regards,|||Hi Ralph,
Thanks for your assistance. I have tried to compile the code in Visual
Studio 2003 with some minor modifications due to certain assembly not
available in 2003 and it worked, not sure why. By the way, the
authentication that you referred to is the C# code (my class library) where I
used it to connect to SQL server ? If yes, in fact, I tried both SQL and
Window authentication in my code but still encounter the same error.
Thanks,
chlow
"Ralph Watermann" wrote:
> Hi,
>
> Do you deploy to a Windows 2003 Server? Then try to use SQL-Server
> Authentication. This worked for us. No idea why Integrated Security only
> worked on XP.
>
> Regards,
>
>
> "chlow" <chlow@.discussions.microsoft.com> schrieb im Newsbeitrag
> news:EE2DC3D3-1FCF-4A00-9FBF-585B83651EDD@.microsoft.com...
> > Hi,
> >
> > I have written an simple class in C# code for retrieving data from SQL
> > 2005,
> > I could not solve the problem at run time (showed #Error) although I have
> > :-
> >
> > a) Include the assert statement as below :-
> > System.Data.SqlClient.SqlClientPermission oPerm = new
> > System.Data.SqlClient.SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted);
> > oPerm.Assert();
> >
> > b) Adding code group as below :-
> > <CodeGroup
> > class="UnionCodeGroup" version="1" PermissionSetName="FullTrust"
> > Name="Copy
> > of TestCodeGroup" Description="Why didn't
> > work?"> <IMembershipCondition
> > class="UrlMembershipCondition" version="1.0.0.0" Url="C:\Program
> > Files\Microsoft SQL Server\MSSQL.4\Reporting
> > Services\ReportServer\bin\prj_RptLib.dll" />
> > </CodeGroup>
> >
> > I tried the position of the code group, created strong name but still
> > could
> > not make get the problem solved.
> >
> > I really appreciate if anyone could help to provide any information or
> > solution.
> >
> > Regards,
>
>

Custom Assembly

Is it possible to run a custom assembly when the 'View Report' button
is pressed?
Many Thanks
DavidI dont think that event can be be trapped.
Amarnath
"davidswain2005@.yahoo.co.uk" wrote:
> Is it possible to run a custom assembly when the 'View Report' button
> is pressed?
> Many Thanks
> David
>

Tuesday, February 14, 2012

cursors are bad

These guys I work with have some sql scripts they run over night and they bog down the server and the machine will be gummed up in the morning etc..

Well, I finally looked at this processing and the culprit is cursors. And cursors within cursors. I would like to just get some opinions about what would be more processor efficient so I can send my boss a link to this thread.

Using a cursors to pull records and update them.

vs

Create script using a scripting language that pulls the records through ADO, loops through them and performs updates as necessary using update statements and the like.

Be nice. I have to work with these guys.In my experience, T-SQL cursors are a generally bad idea. Most books I have read use the first page of the cursors chapter to say how bad cursors can be, then go on to describe how to build one.

In order to see how cursors impact performance, I have found that the best way to show people how bad they are, is to show them a perfmon with a pretty line showing CPU usage. Then run the cursor, and point out the big spike. Then ask them to imagine what happens when 4 or 5 more people run that cursor at the same time...

You should also mention that multiple application servers can be added on, but you will always be cursed with a single database machine. If the database machine is resource bound, no amount of extra application servers can help you.

As for how ADO stacks up, you may have to stage a race between a couple of processes. One T-SQL cursor based, and the other ADO based, and see who wins.

Hope this helps.|||And nested cursors are extremely bad...

The must open the first,
then open then next, Fetch and then close
then open then next, Fetch and then close
then open then next, Fetch and then close
then open then next, Fetch and then close
then open then next, Fetch and then close
then open then next, Fetch and then close
then open then next, Fetch and then close
then open then next, Fetch and then close
then open then next, Fetch and then close
then open then next, Fetch and then close
then open then next, Fetch and then close

Put a dress on a cursor and you know what you have?

Anyway...You could just do it a set based method..

Got a sample of some code?|||At least in my experience, set-based solutions are at least one order of magnitude (ten times) faster than cursors in Microsoft SQL. They are often much faster than that, but the 10 times benchmark is easy to hit so that's all that I claim up front.

In every form of data processing, the closer you can keep the processing to the hardware itself, the faster the process runs. Cache is faster than disk, set based solutions on the SQL Server are faster than cursors, which can be faster than ADO under the right circumstances.

Rather than argue for ages or produce/quote meaningless benchmarks, I'd suggest you try it. Take a very simple process that affects many rows and rewrite it as either ADO, set based, or both. Compare doing the same task all three ways.

I'm confident that the set based solution will comfortably outperform any other way of solving the problem. ADO will probably come next, depending on the amount of network I/O it has to do. I'd expect the cursor to come in dead last.

I'd really like to hear your results when you get them!

-PatP|||thanks guys.

I have what looks like a few hundred .sql files. I have done set based querying before. I am not as tough as you guys but I am studying everyday.|||Can post or attach a small one so we can take a look?|||if it was my code I would but I probably should'nt because I gave the CIO a link to the thread.

95% chance they won't do anything with the advice. there is never any time or resources for anything here. they brought me into fix things and they tied my hands in the first week I was here by telling me I could not change any of the existing stuff and everything had to be a workaround.

I have told myself I have to stick it out for a year and then I would evaluate the situation. It's almost been 6 months.|||OK...

What I would do.

From a client, use Profiler to record some statistics.

Then "clone" and existing cursor process with a set based solution. Give us some "examples" that are close to what yo uhave so we can help.

Make sure the results produced are identical...write them to work tables for proof.

Publish your results.

If the results are anywhere what I expect it should be clear that it should be rewritten...it can be done a little at a time, and not everything has to be done...just find the biggest offenders...

How big is the database?

I'd dump and restore a copy of production so you can have your own dev environement...

Anyway...good luck

CIO

Constantly Ignorant Officer|||Check you calendar. It's probably only been two weeks, and just SEEMS like six months.

How are you supposed to fix anything if you can't change anything?

Do you take your car into the shop and say, "Make it run better, but don't touch the engine?"

Seems like the only thing you could recommend would be a massive upgrade to the hardware. See how they like the price-tag on that.|||Blindman,

Trust me I know. They have already talked hardware. In my last company, a few years ago when I was just a pup of a developer they beefed up the db server hardware for crappy application they were running and saw little or no gain because the code was so bad. they finally revamped the app and it was'nt until then that things got better.

I am thinking about switching auto shops. I am going to reproduce things on my local like Brett said when I get a chance. Maybe this weekend. I have app development to do today.