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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:49:44+00:00 2026-06-04T18:49:44+00:00

I’m trying to create a table in a database using SQL. The data is

  • 0

I’m trying to create a table in a database using SQL. The data is currently in a text file that looks like this, but has thousands of lines like that.

My trouble lies primarily in the parameters of the “CREATE TABLE” function. Is there a way to say that I want all of the columns? Right now the code looks like:

CREATE TABLE dbo.CFTC_Fin_Data
(

)

BULK INSERT dbo.CFTC_Fin_Data
    FROM 'H:\user\Desktop\CFTCData1.txt' 
    WITH 
    ( 
        FIELDTERMINATOR = ',', 
        ROWTERMINATOR = '\n' 
    );

Thanks for any help. I’m pretty new to SQL, so I apologize if similar questions have been answered already, but I couldn’t understand any of the answers that I read.

  • 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-04T18:49:46+00:00Added an answer on June 4, 2026 at 6:49 pm

    Well, you have to look at your file and see what kind of info you have in each field.

    With the line in your files, it seems that

    Field1 is a string (3 char, maybe more in other lines) ? => NVARCHAR(100)

    Field2 is a string (xx char) => NVARCHAR(255)

    Field3 is a DATE => DATE

    Field4 seems to be all kind of things => NVARCHAR(100)

    So something like

    CREATE TABLE dbo.CTFC_Fin_Data (
    column1 NVARCHAR(100),
    column2 NVARCHAR(255),
    column3 DATE,
    column4 NVARCHAR(100)
    )
    

    But you need to examinate all your file to find the real right values and data types

    EDIT :

    In fact, your really need to do it with code ?

    Cause with import-export wizard (in SQL Server Management Studio), you can import a data file, and the wizard can create the table for you if you need to.

    Try :

    Right-click on your database name,
    => Tasks
    => Import Data

    and follow the wizard.

    You can also save the SSIS package if you need to.

    Think it will be much more appropriate for you !

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I have a reasonable size flat file database of text documents mostly saved in
I have some data like this: 1 2 3 4 5 9 2 6
Basically, what I'm trying to create is a page of div tags, each has
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace

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.