We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,985 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Looking for work-around

I want to have the following on SQL Azure:

IF EXISTS(SELECT * FROM [sys].[databases] WHERE [name] = db_name() AND [compatibility_level] = 110)
BEGIN
    ALTER PROCEDURE [dbo].[Test] AS 
    BEGIN 
        -- Omitted body containing lots of strings
    END
END

or a work-around that does something similar. What follows is what I'm trying to avoid:

IF EXISTS(SELECT * FROM [sys].[databases] WHERE [name] = db_name() AND [compatibility_level] = 110)
BEGIN
    EXEC [sys].[sp_executesql] N'ALTER PROCEDURE [dbo].[Test] AS 
    BEGIN 
        -- Omitted body containing lots of strings
    END'
END

The reason I want to avoid the above, is because the stored procedure contains a lot of strings that need escaping.

2
Contributors
2
Replies
22 Hours
Discussion Span
3 Months Ago
Last Updated
17
Views
pritaeas
Posting Prodigy
Moderator
9,268 posts since Jul 2006
Reputation Points: 1,173
Solved Threads: 1,456
Skill Endorsements: 86

@pritaeas

Looking for work-around

What do you mean by work around? I never heard work around. I know you are using SQL Azure.

You can try Start a Job or Stop a Job:

This is for stop a job:

CREATE PROCEDURE [sys].[StopJob](@id)
AS
UPDATE [databases]
WHERE [name] = db_name()
AND [compatibility_level] = 110

ALTER PROCEDURE [dbo].[Test]
AS
BEGIN 
LastMitch
Industrious Poster
4,146 posts since Mar 2012
Reputation Points: 132
Solved Threads: 334
Skill Endorsements: 45

I'm not sure what you are getting at. My problem is just that the 1st SQL shown doesn't work, and I am looking for something other than the 2nd. I don't see any relation to jobs.

pritaeas
Posting Prodigy
Moderator
9,268 posts since Jul 2006
Reputation Points: 1,173
Solved Threads: 1,456
Skill Endorsements: 86

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.3073 seconds using 2.65MB