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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:48:36+00:00 2026-06-01T20:48:36+00:00

I’m working on a SSIS package. I have an array with a list of

  • 0

I’m working on a SSIS package. I have an array with a list of names. Those names will be table names.

To create those tables, I loop a SQL task editor EXECUTING a stored procedure accepting a parameter (name of the table)

Code for the stored procedure:

ALTER PROCEDURE [dbo].[TLP.CreaTable]
(
    @TableName  VARCHAR(255)
)
AS
BEGIN
    SET NOCOUNT ON

    DECLARE @SQL VARCHAR(4000)
    SET @SQL = 'IF NOT EXISTS ( SELECT  * 
                                FROM    sysobjects 
                                WHERE   id = OBJECT_ID(N''[dbo].' + @TableName + ''') 
                                AND     xtype in (N''U'')) 
                    CREATE TABLE [dbo].' + @TableName + '(
                        [Serial] [int] NOT NULL,
                        [Marc] [bit] NOT NULL,
                        [Sell] [bit] NOT NULL
) ON [PRIMARY]'

    EXEC (@SQL)
END

The issue comes when one of the names in the array is a number. I must say all the names enter the stored procedure with []. I’ve created a breakpoint before each execution and when the table name is a number it brings an error inside the SSIS (Also for you to have a better idea Ive ran the stored procedure from the SQL Server Management Studio, and the error persists, Ive used the table name [3001] which is actually a real name that’s causing the problem).

EXEC dbo.[TLP.CreaTable] [3001]

Msg 170, Level 15, State 1, Line 5 Line 5: Incorrect syntax near ‘.3001’.

If I do something like

EXEC dbo.[TLP.CreaTable] RANDOM_NAME

It works just perfectly

Apparently there’s some ‘.’ in the middle. But I just cant find it in the code.

Thanks

EDIT:

It was a matter of quotation. It worked in the SQL Server Management Studio. But when I tried it in the SSIS the error persisted. Tried modifying the C# code to add ‘[ ]’ instead of just [] and it didn’t work eiter.

The error inside the SSIS is as follows.

Error: 0xC002F210 at Create Table 030698, Execute SQL Task: Executing the query “EXEC dbo.[TLP.CreaTable] ?” failed with the following error: “An error occurred while extracting the result into a variable of type (DBTYPE_I4)”.
Possible failure reasons: Problems with the query, “ResultSet”
property not set correctly, parameters not set correctly, or
connection not established correctly.

With breakpoints I watched the variable for the table name and it was ok ‘[3001]’

The calling inside the SQL Task Editor is

EXEC dbo.[TLP.CreaTable] ?

But somehow the EXEC dbo.[TLP.CreaTable] '[3001]' works in SQL Server Management Studio, but doesn’t inside the SSIS.

Any idea? Thanks.

EDIT 2

Since Im pretty new to the forum, should I ask this second question in a new ‘question’? Since the matter issued in the subject was solve.
Thanks a lot.

EDIT 3

Fixed. Parameter in CREATE TABLE SQL task editor was long, changed it to varchar and it went smooth.
Thanks

  • 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-01T20:48:39+00:00Added an answer on June 1, 2026 at 8:48 pm

    You could try wrapping @TableName with the QuoteName function which should escape the table name for you. Change that line to:

    CREATE TABLE [dbo].' + QuoteName(@TableName) + '(
    

    Edit: Might also be an idea to wrap the table name in square brackets, in case it’s a reserved word:

    CREATE TABLE [dbo].[' + QuoteName(@TableName) + '] (
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to loop through a bunch of documents I have to put
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from

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.