Hi friends,
I have set of 20 to 25 constant values that is used to assign error codes.
These constants are used in multitiple SP's.
How can I define these constants once and then reuse it?
Example
error_code = 1001 for "Invalid Member"
error_code = 1002 for "Invalid Expert"
these error will occur in multiple sp's. In future if I want to change the
error_code, I should change everywhere, instead if I define in a particular
place and then resuse it. It will be more effective.
How to do this.
I should not use a table to define the error_code.
thanks
vanithaYou have to store it in someplace in order to use it ( a table would be
the place place for that, but you could also use a XML / Ini file where
you read from with openquery, but I think the table approach would eb
the best solutions for that)
HTH, Jens Suessmeyer.|||Vanitha
you can define custom errors in sql server with sp_addmessage. The custom
errors starts from 50001. see BOL for topics sp_addmessage,@.@.error,Raiserror
.
You should never define errors below50000 as they are already defined.
SARENA AMMAI
Regards
R.D
"vanitha" wrote:
> Hi friends,
> I have set of 20 to 25 constant values that is used to assign error codes.
> These constants are used in multitiple SP's.
> How can I define these constants once and then reuse it?
> Example
> error_code = 1001 for "Invalid Member"
> error_code = 1002 for "Invalid Expert"
> these error will occur in multiple sp's. In future if I want to change the
> error_code, I should change everywhere, instead if I define in a particula
r
> place and then resuse it. It will be more effective.
> How to do this.
> I should not use a table to define the error_code.
> thanks
> vanitha|||Thanks a lot.
The custom error messages is added, now how will I use it inside SP?
then this method will update the system table Sysmessages, I am not sure
whether I have permission in the production DB to do this?
thanks
"R.D" wrote:
> Vanitha
> you can define custom errors in sql server with sp_addmessage. The custom
> errors starts from 50001. see BOL for topics sp_addmessage,@.@.error,Raiserr
or.
> You should never define errors below50000 as they are already defined.
> SARENA AMMAI
> Regards
> R.D
>
>
> "vanitha" wrote:
>|||Vanitha
if you have added, then you already had permissions on sysmessages.Other
wise ask your DBA to add.
Now you can use @.@.error to return that number and store it immediately to
another variable.
You can also use RAISERROR.
BOL has good material on this.
btw Meeru ekkada nundi post chestunaru!
Regards
R.D
"vanitha" wrote:
> Thanks a lot.
> The custom error messages is added, now how will I use it inside SP?
> then this method will update the system table Sysmessages, I am not sure
> whether I have permission in the production DB to do this?
> thanks
> "R.D" wrote:
>|||if the Messages should be transfered to another server you can use this
script (tested) that will do the work and create a insert script for
the sysmessages:
SELECT 'IF NOT EXISTS (SELECT * FROM master..sysmessages where
error = ' + CAST(sm.error as varchar(10)) + ' and msglangid = ' +
CAST(sm.msglangid as varchar(10)) + ')' + CHAR(13) +
' EXEC sp_addmessage @.msgnum = ' + CAST(error
as varchar(10)) +
' ,@.severity = ' + CAST(severity as
varchar(10)) +
' ,@.msgtext = N''' + replace(description, '''',
''') + '''' +
' ,@.lang = ''' + lg.name + '''' + CHAR(13)+
'GO' + CHAR(13)
FROM master..sysmessages sm
Inner join master..syslanguages lg
ON sm.msglangid = lg.msglangid
HTH, Jens Suessmeyer.
Showing posts with label constant. Show all posts
Showing posts with label constant. Show all posts
Sunday, February 19, 2012
global constant for multiple reports
I have a set of 25 reports that contain the links to the other application
(URL). Is there a way to define a single "global" string for all the reports
to quickly replace that url with the right one? Let's say it's
http://testingserver/app for testing, and http://production/app for
production. I hate to change the link value on every report. Using custom
assemblies to keep such common references looks like too much overhead. Are
there any other global report configuration options I'm missing?
--
Regards,
Dmitry DuginovHello Dmitry,
You could do this in the VS.NET 2005 IDE.
Click the Edit -> Find and Replace -> Replace in Files.
Type the http://testingserver/app in the Find what section, and type
http://production/app in the Replace with section.
Then, click the Find options and type *.rdl in the Look at these file types.
And then, you could click replace all button and all the files in your
solutionn will be modified.
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================(This posting is provided "AS IS", with no warranties, and confers no
rights.)|||Sorry, but this "approach" just doesn't sound right. It's
"hardcode-change-redeploy". How it's better than "hardcode-change-recomplie"
for regular applications? It's not; that's why we are always trying to keep
some variables in config files: to change them, not the source code...
D.
"Wei Lu [MSFT]" <weilu@.online.microsoft.com> wrote in message
news:zH9Hlb%239GHA.4432@.TK2MSFTNGXA01.phx.gbl...
> You could do this in the VS.NET 2005 IDE.
> Click the Edit -> Find and Replace -> Replace in Files.
> Type the http://testingserver/app in the Find what section, and type
> http://production/app in the Replace with section.
> Then, click the Find options and type *.rdl in the Look at these file
types.
> And then, you could click replace all button and all the files in your
> solutionn will be modified.
> Sincerely,
> Wei Lu
> Microsoft Online Community Support
> ==================================================> Get notification to my posts through email? Please refer to
>
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
> ications.
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscriptions/support/default.aspx.
> ==================================================> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>|||Hello Dmitry,
You could not do this in the Reporting Services Designer.
Since the RDL file is a XML format file, you could modify the xml file
before you deploy to the report server.
This is the only approach you could do in the reporting services.
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.|||Hi ,
How is everything going? Please feel free to let me know if you need any
assistance.
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.
(URL). Is there a way to define a single "global" string for all the reports
to quickly replace that url with the right one? Let's say it's
http://testingserver/app for testing, and http://production/app for
production. I hate to change the link value on every report. Using custom
assemblies to keep such common references looks like too much overhead. Are
there any other global report configuration options I'm missing?
--
Regards,
Dmitry DuginovHello Dmitry,
You could do this in the VS.NET 2005 IDE.
Click the Edit -> Find and Replace -> Replace in Files.
Type the http://testingserver/app in the Find what section, and type
http://production/app in the Replace with section.
Then, click the Find options and type *.rdl in the Look at these file types.
And then, you could click replace all button and all the files in your
solutionn will be modified.
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================(This posting is provided "AS IS", with no warranties, and confers no
rights.)|||Sorry, but this "approach" just doesn't sound right. It's
"hardcode-change-redeploy". How it's better than "hardcode-change-recomplie"
for regular applications? It's not; that's why we are always trying to keep
some variables in config files: to change them, not the source code...
D.
"Wei Lu [MSFT]" <weilu@.online.microsoft.com> wrote in message
news:zH9Hlb%239GHA.4432@.TK2MSFTNGXA01.phx.gbl...
> You could do this in the VS.NET 2005 IDE.
> Click the Edit -> Find and Replace -> Replace in Files.
> Type the http://testingserver/app in the Find what section, and type
> http://production/app in the Replace with section.
> Then, click the Find options and type *.rdl in the Look at these file
types.
> And then, you could click replace all button and all the files in your
> solutionn will be modified.
> Sincerely,
> Wei Lu
> Microsoft Online Community Support
> ==================================================> Get notification to my posts through email? Please refer to
>
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
> ications.
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscriptions/support/default.aspx.
> ==================================================> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>|||Hello Dmitry,
You could not do this in the Reporting Services Designer.
Since the RDL file is a XML format file, you could modify the xml file
before you deploy to the report server.
This is the only approach you could do in the reporting services.
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.|||Hi ,
How is everything going? Please feel free to let me know if you need any
assistance.
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.
Subscribe to:
Posts (Atom)