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 4123060
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:33:46+00:00 2026-05-20T23:33:46+00:00

Getting very annoyed with this simple query… I need to add an offset to

  • 0

Getting very annoyed with this simple query…
I need to add an offset to a varchar, if it’s a number and do nothing is it is not.
For this reason I’ve created the following function in SQL-server.
I then extract the answer with:
select dbo.OffsetKPL("100",200)

However this does not work, I get the error

Msg 207, Level 16, State 1, Line 1
Invalid column name ‘100’.

The code for the function is as follows…

ALTER FUNCTION [dbo].[OffsetKPL](
  @kpl varchar(20)
  ,@offset int = 0
)
RETURNS varchar(20)
AS
BEGIN   
  DECLARE @uitkomst varchar(20);

  set @uitkomst = @kpl;
  if not(@offset = 0) begin
    if (IsNumeric(@uitkomst) = 1) begin
      set @uitkomst = cast((cast(@kpl as int) + @offset) as varchar);
    end;
end;

RETURN @uitkomst;

END

What’s wrong? nowhere does it state that IsNumeric does not accept a variable.

  • 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-05-20T23:33:46+00:00Added an answer on May 20, 2026 at 11:33 pm

    Use single quotes for strings!

    select dbo.OffsetKPL('100',200)
    

    If you have QUOTED_IDENTIFIER on (the default) things in double quotes are expected to be object names.

    isnumeric may not be what you need though as all kinds of unexpected things return 1 for this.

    SELECT ISNUMERIC('$'), ISNUMERIC('.'), 
           ISNUMERIC('12d5'), ISNUMERIC(','), ISNUMERIC('1e1')
    

    See IsNumeric() Broken? Only up to a point for some discussion on this point.

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

Sidebar

Related Questions

I've been staring at this for a while and not getting very far. FruitBasketFactory,
Excuse the newbness of this, I'm not getting very far relying on google and
I have seen a couple threads about this, but am not getting very straight
I am getting a very strange error in my code. This assignment is for
I'm getting very strange logs tagged 'webcore' when trying to input number in textfield.
I am trying to parse XML with Python but not getting very far. I
Alright, so this is getting very very annoying. I have an unmanaged VC 2010
I am getting very strange errors and i am not able to understand what
Please take a look at this code and run it: I'm getting very strange
I am getting very frustrated with this jquery form validation ajaxSubmit(); In chrome, it

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.