Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9215281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:10:10+00:00 2026-06-18T02:10:10+00:00

I have a sproc like so, it basically appends a prefix to a field

  • 0

I have a sproc like so, it basically appends a prefix to a field if it does not already exist:

ALTER PROCEDURE [dbo].[AgSp_UpdateAgTbl_Licensing ](@newPrefix nvarchar, @systemName nvarchar)

AS
BEGIN
       -- SET NOCOUNT ON added to prevent extra result sets from
       -- interfering with SELECT statements.
       SET NOCOUNT ON;

update AgTbl_Licensing
set   UrlPrefixes =
           case
               when UrlPrefixes is null or UrlPrefixes = ''
               then @newPrefix
               else convert ( nvarchar( max ), UrlPrefixes) + ', '+@newPrefix
            end
where SystemName = @systemName and (UrlPrefixes not like ('%'+@newPrefix+'%') or UrlPrefixes is null)

END

I try and call this like so:

Execute AgSp_UpdateAgTbl_Licensing 'eb_', 'EB1';

but updates are not being made to the db – how come? i cant debug as i dont have sysadmin

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T02:10:12+00:00Added an answer on June 18, 2026 at 2:10 am

    I think you should declare procedure parameters with length as;

    @newPrefix nvarchar(50), @systemName nvarchar(50)
    

    Otherwise it will take only FIRST character of your string and therefore your WHERE clause fails to find the records to be updated. And also your parameters are not what you expecting them to be.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=
I have an sproc in SQL Server 2008. It basically builds a string, and
I have a stored procedure (sproc) called resetflags. It takes an int parameter. Another
I'd like some help writing the following sproc: I have SQL Server 2008 sproc
If I have tables like this: ImportSet1.Users ImportSet2.Users ImportSet3.Users Then in my sproc I
I have seen various rules for naming stored procedures. Some people prefix the sproc
Im trying to write the results from a SProc to a textfile. I have
Basically, I want to use the nice Dapper syntax for a stored procedure, without
I have a TSQL sproc that builds a query as and executes it as
I have a stored procedure that returns a result set (4 columns x n

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.