Results 1 to 6 of 6

Thread: [RESOLVED] Create Table

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Posts
    688

    Resolved [RESOLVED] Create Table

    Hi

    I am creating table through coding , i want active field should have default value = "Y"

    sql = " CREATE TABLE Test" & "" _
    & " (tcode nvarchar(10) NOT NULL Primary Key, " _
    & " tname nvarchar(100) NULL," _
    & " active nvarchar(1) NULL," _
    & ")"
    cnn.Execute (sql)

    Thanks

  2. #2
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Create Table

    Something along the lines of

    sql Code:
    1. INSERT INTO `test` (`tcode`, `tname`, `active`) VALUES
    2. (1, NULL, 'Y');

    should work.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Posts
    688

    Re: Create Table

    Hi

    I want this during Table Creation , i don't want through Insert statement.

    Thanks

  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Create Table

    Moved to the Database Development forum.

  5. #5
    Frenzied Member IanRyder's Avatar
    Join Date
    Jan 2013
    Location
    Healing, UK
    Posts
    1,232

    Re: Create Table

    Hi,

    Here you go:-

    Code:
    CREATE TABLE Test (active nvarchar(1) NULL default 'Y')
    Hope that helps.

    Cheers,

    Ian

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Posts
    688

    Re: Create Table

    Hi Ryder

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width