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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:26:17+00:00 2026-05-12T00:26:17+00:00

I am creating a windows application using VB.Net and this application will take a

  • 0

I am creating a windows application using VB.Net and this application will take a SQl create .sql file as a parameter and will return all fields and their data types inside in a list or array.

Example:

USE [MyDB] GO /****** Object: Table [dbo].[User] Script Date: 07/07/2009 10:16:48 ******/ 

SET 
ANSI_NULLS ON GO 

SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[User]( [UserId] [int] IDENTITY(1,1) NOT NULL, 

[FirstName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [MiddleName] 

[varchar](50) COLLATE SQL_Latin1_General_CP1_CI_A 

Should Return:

UserId int, FirstName string, MiddleName string

I want to do this by any way, pure vb.net code or using RegEx.

Anyone knows the fastest way to finish this?

  • 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-12T00:26:17+00:00Added an answer on May 12, 2026 at 12:26 am

    First, what flavor of SQL are you using? Second, the syntax for CREATE TABLE can be fairly “detailed”. Are you dealing with a smaller subset of the general syntax that might make approaching this problem simpler?

    But rather than trying to parse the statement, the fastest way might be having a trash database that you can execute the CREATE TABLE statement on, and then extracting the column names and types via

    SELECT COLUMN_NAME, DATA_TYPE
    FROM INFORMATION_SCHEMA.COLUMNS
    WHERE TABLE_NAME='MyCreatedTable'
    

    (I am assuming SQL Server here.)

    Thusly,

    string createTableCommandText; // "CREATE TABLE MyCreatedTable..."
    using(var connection = new SqlConnection(connectionString)) {
        connection.Open();
        var createCommand = connection.CreateCommand();
        createCommand.CommandText = createTableCommandText;
        createCommand.ExecuteNonQuery();
    
        var schemaCommand = connection.CreateCommand();
        schemaCommand.CommandText = "SELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MyCreatedTable'";
        var reader = schemaCommand.ExecuteReader();
        while(reader.Read()) {
            Console.WriteLine(String.Format("{0}|{1}", reader["COLUMN_NAME"], reader["DATA_TYPE"]));
        }
    
        var deleteCommand = connection.CreateCommand();
        deleteCommand.CommandText = "DROP TABLE MyCreatedTable";
        deleteCommand.ExecuteNonQuery();
    }
    

    Sorry that it’s in C#. I am not fluent enough with VB to write approximately correct code without a compiler at my fingertips.

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

Sidebar

Ask A Question

Stats

  • Questions 167k
  • Answers 167k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I agree with all other people in this thread by… May 12, 2026 at 1:36 pm
  • Editorial Team
    Editorial Team added an answer A trend is just a number calculated at regular intervals.… May 12, 2026 at 1:36 pm
  • Editorial Team
    Editorial Team added an answer No there is not, the ? operator is itself a… May 12, 2026 at 1:36 pm

Related Questions

Solution (kinda): Turns out this impersonation with .NET's security only allows application-level access. Since
I am creating a windows application. I am now concentrating on the Reporting Module
I am creating a mobile web application using asp.net. The application must support iPhone,
I am creating a Windows Service in .NET to which N number of client

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.