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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:10:03+00:00 2026-05-30T21:10:03+00:00

Can I use varchar parameters in my stored procedure without declaring its length? For

  • 0

Can I use varchar parameters in my stored procedure without declaring its length? For example I would like to declare my stored procedure as follows:

CREATE PROCEDURE [TEST] 
    @Domain varchar,
    @Numbers int
AS
 .....

It’s much easier for me if the stored procedure can automatically detect the parameter length, in this case if I changed the column length in my table I will not need to go and update all my stored procedures that uses this column.

Thank you,

  • 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-30T21:10:05+00:00Added an answer on May 30, 2026 at 9:10 pm

    If you omit the length, it defaults to one character.
    For example: varchar is a synonym for varchar(1).

    One way to define the length in one place is a type, like:

    create type Domain from varchar(30) not null;
    

    You can then use this new type in other definitions:

    create procedure TestProcedure @par1 domain as select @par1
    go
    create table TestTable (col1 domain)
    

    However, you can’t change the definition of a type without dropping everything that uses it.

    In my experience, data length changes are rare, and when they happen, they’re easy to refactor manually. So I’d stick to varchar(x) instead of a type.

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

Sidebar

Related Questions

I want to pass 2 parameters to SQL stored procedure and use like statement
In MySQL 5, a stored procedure can return any number of output parameters, like
I'm trying to create a simple stored procedure which I can use to write
I can use the following code for tiny little queries: DECLARE @sql VARCHAR(8000) SET
I have a stored procedure which takes as its parameter a varchar which needs
I would like to use hilo generator but there is no any complete example
ALTER PROCEDURE [dbo].[getMessages] -- Add the parameters for the stored procedure here @lastRow int,
I've got a stored procedure I use to insert data from a csv. The
I need to use a cursor to call a stored procedure that has 2
I've got a mySql stored procedure that looks like this-- delimiter | create procedure

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.