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

  • SEARCH
  • Home
  • 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 8989289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:13:14+00:00 2026-06-15T22:13:14+00:00

i want to write a UDF which uses String Value and starting index number

  • 0

i want to write a UDF which uses String Value and starting index number and count number like that:

GetValueUDF(“i am 18 years old.”,6,2) output: 18 , 6: .nth starting point, 2: count

GetValueUDF(“i am 101 years old.”,6,3) output: 101

GetValueUDF(“i am 101 years old.”,1,4) output: “i am”

  • 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-15T22:13:16+00:00Added an answer on June 15, 2026 at 10:13 pm

    I am not quite sure why you want to create a user defined function for this since that is what the substring function does. But you should be able to use something like the following:

    create function GetValueUDF
    (
      @string varchar(max), 
      @startPosition int,
      @length int
    )
    returns varchar(max)
    as
    
    begin
      return substring(@string, @startPosition, @length)
    end
    

    See SQL Fiddle with Demo

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

Sidebar

Related Questions

I want write code in c# which i need to get like this .
I want write a simple query which will fetch data from a table (which
I want write a little code analyzer which parses nested structures and translates into
I want to write a program in Prolog that confirms if a b-tree of
suppose we have two numbers i want write program which print common bits subsequent
I use trap to write errors to file, and want write line number where
I want write a program that when installed, runs in background and adds a
I want write function something like this getLine($mySteing){ ..... } How to get line
Hi this is newbie in python, I want write a prioritized decorator which will
I'd like to count the number of keys in a map in Pig. I

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.