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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:33:20+00:00 2026-06-15T16:33:20+00:00

I have a problem with my stored procedure ALTER PROCEDURE [dbo].[TIGER_CREATE_RUNTIME_TABLE](@NOMBRE_TABLA varchar(100)) AS DECLARE

  • 0

I have a problem with my stored procedure

ALTER PROCEDURE [dbo].[TIGER_CREATE_RUNTIME_TABLE](@NOMBRE_TABLA varchar(100))
AS
    DECLARE @SQLQUERY1 AS NVARCHAR(600)
BEGIN
    SET @SQLQUERY1 = 'CREATE TABLE '+@NOMBRE_TABLA + '(
    SEGMENTO varchar(200) NULL,
    TCNFOL varchar(200) NOT NULL,
    TCCOPL_A varchar(200) NULL,
    ID_LIN_NEG varchar(200) NULL,
    TIP_LIN varchar(200) NULL,
    MON_ID_MONEDA varchar(200) NULL,
    LINEAS_FACT varchar(200) NULL,
    CF_VOZ varchar(200) NULL,
    CF_DATOS varchar(200) NULL,
    ADIC_MINS varchar(200) NULL,
    ADIC_LDN varchar(200) NULL,
    ADIC_LDI varchar(200) NULL,
    ADIC_SMS varchar(200) NULL,
    PAQ_SMS varchar(200) NULL,
    ADIC_DATOS varchar(200) NULL,
    OTROS varchar(200) NULL,
    SUB_TOT varchar(200) NULL,
    PERIODO_ANALISIS varchar(200) NULL,
    PERIODO_ALTA varchar(200) NULL,
    CATEGORIA varchar(200) NULL,
    RUC varchar(200) NULL)'

    EXEC sp_ExecuteSql @SQLQUERY1
END

As you can see, I’m using dynamic SQL, but there is an error while I execute it.

Mens. 102, Level 15, State 1, Line 20
Incorrect syntax near ‘varch’.

Is there any wrong with dynamic SQL? Thanks for a while.

  • 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-15T16:33:21+00:00Added an answer on June 15, 2026 at 4:33 pm

    I would change your @sqlquery1 to varchar(max), I think you are hitting the character limit when you add your table name:

     DECLARE @SQLQUERY1 AS NVARCHAR(max)
    

    You have your limit of your query string set to 600 but when you add in a table name of up to varchar(100) you are most likely going over the limit.

    If you run just the following with no table name the len is 726 characters:

    DECLARE @SQLQUERY1 AS NVARCHAR(max)
    
    SET @SQLQUERY1 = 'CREATE TABLE (
        SEGMENTO varchar(200) NULL,
        TCNFOL varchar(200) NOT NULL,
        TCCOPL_A varchar(200) NULL,
        ID_LIN_NEG varchar(200) NULL,
        TIP_LIN varchar(200) NULL,
        MON_ID_MONEDA varchar(200) NULL,
        LINEAS_FACT varchar(200) NULL,
        CF_VOZ varchar(200) NULL,
        CF_DATOS varchar(200) NULL,
        ADIC_MINS varchar(200) NULL,
        ADIC_LDN varchar(200) NULL,
        ADIC_LDI varchar(200) NULL,
        ADIC_SMS varchar(200) NULL,
        PAQ_SMS varchar(200) NULL,
        ADIC_DATOS varchar(200) NULL,
        OTROS varchar(200) NULL,
        SUB_TOT varchar(200) NULL,
        PERIODO_ANALISIS varchar(200) NULL,
        PERIODO_ALTA varchar(200) NULL,
        CATEGORIA varchar(200) NULL,
        RUC varchar(200) NULL)'
    
    select LEN(@sqlquery1)
    

    If you leave your query string at a length of 600 your create table statement will be cut off and will generate an error.

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

Sidebar

Related Questions

I have a stored procedure in this form: ALTER PROCEDURE [dbo].[fooBar] ( ) AS
I have problem with ASP.net and stored procedure My procedure in SQL Server: ALTER
I have a problem when debugging stored procedure using SQL server Management Studio 2008.
I have this stored procedure for Oracle: create or replace procedure bns_saa_message_get() <--- PROBLEM
I have a stored procedure that runs the following: 'ALTER LOGIN ' + @Login
I do have a problem. I am trying to return from the Stored procedure
I am facing this problem. I have a stored procedure which returns 6 rows
I have a problem executing a stored procedure in Silverlight 4/RIA. The only value
I'm using devexpress and i have two problems. My insert stored procedure work fine.
I'm having a never-ending problem with trying to call a stored procedure from a

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.