Creating Tables with sql express

I know this deals with ms sql express more so than vb.net but it correlates b/c I want to edit the database with vb.net express. On to my question...

I'm trying to learn how to use ms sql express using the SQL Express Manager. However, I can't seem to figure out how to create tables. I'm reading http://msdn.microsoft.com/SQL/2005/getstarted/default.aspx pull=/msdnmag/issues/04/09/expresseditions/toc.asp but it seems outdated and I can't replicate what he's doing in the tutorial. I'm not a total novice when it comes to programming, but SQL Express Manager isn't as intuitive as one might think, there's no "Create Table" context menu. Can anyone throw me a clue


Answer this question

Creating Tables with sql express

  • GTVic

    Following up on what Paul said...

    VB Express provides a UI to create tables in the database. First, create a connection to the database. You can either:

    a. Add the file to your project through Solution Explorer (right-click on the project node and select Add->Existing Item, browse to your file)

     - or -

    b. Create a connection in Database Explorer
        1. View->Database Explorer
        2. Click the Connect to Database toolbar button in the Database Explorer window
        3. Choose Microsoft SQL Server Database File as the Data Source
        4. Browse to your file

    After that, just right-click on the Tables node for your database in Database Explorer and select Add New Table. You can add columns, set their data type and other properties, etc. Click Save when you're done and you will be prompted for a table name. It's pretty easy to use.

    I hope this helps.

    Jay Hickerson
    Visual Basic Team

  • soul_blight

    I have already looked through it and read some of it and find that it is incomplete. I guess I can pick up a t-sql book at the store since the syntax shouldn't change... right



  • Alex Norko

    Hi,

    The BOL (Books On-Line) for SQLServer Express is a very rich t-sql reference...

    Download it here.

     

    cheers,

    Paul June A. Domag



  • MichaelMouer

    Jay:

    When I select Add New Table (either from Right Click on the Table Node, or The Data Menu Add New Table), I get an error message "The parameter is incorrect" (that's all, no other info provided). I have researched the Help associated with the Error (Clicking on the ' '), but it's not very revealing.

    I have seen a similar posting on here a couple of months ago, but there were no replies.

    Ideas

    Thanks.


  • Carl Meek

    Hi K4CY,

    A few questions:

    Is this with a SQL Express database or a different database

    Where did the database come from (did it already exist or did you create a new one through Visual Studio)

    Also, can you post your connection string You can find it by right-clicking on the database in Server/Database Explorer, selecting Modify Connection, and then clicking Advanced on the Modify Connection dialog. It will be in a read-only textbox at the bottom of the dialog.

    Thanks,



  • Glen Wells

    Thanks for posting the information. The connection string looks OK. I can't think of any specific things that would cause either of these behaviors. Since the database is brand new and presumably doesn't have any sensitive data in it, would you be willing to send us the database If so, could you file a bug report on this website: http://lab.msdn.microsoft.com/productfeedback/. Please include the database file or even zip up the whole project and include it. Also, put as much information as you can think of about how to reproduce the problem. Include the steps to see the error and any information about your environment that might make it special (things like using a non-English OS with an English VS or defaults that you have changed, etc.). The bug will be routed to the appropriate team to investigate.

    I'm sorry I can't provide any suggestions about how to fix this.



  • Welsh-Wizard

    Hi,

    To your question, yes there's no t-sql language change. So even your old t-sql manual would still work for you. But there are microsoft specific t-sql stored procs that might change per version. But if your only using t-sql ANSI specific then any t-sql manual would definitely work for you...

     

    cheers,

    Paul June A. Domag



  • Matt Pickle

    No, problem was not resolved. I have temporarily abandoned the project.

    Good luck,


  • Hath

    Cool, this was the answer I was looking for.  Since Paul brought it up, any useful links to t-sql for ms sql express Eventually I figure I have to learn t-sql.

  • toby1212

    Nevermind, I DL'ed the wrong file :)

  • xeno

    Jay:

    Thanks for your efforts. Clearly there's something missing/wrong with my VB/SQL Express install/setup. No, there's no sensitive data in the database (I can't create any tables :), there's no data in the database. I'll install everything on a different machine, and try again.


  • PascalD

    Hi,

    On creating a table in SQLExpress, you could issue a CREATE TABLE t-sql command on a query then execute it. The Xpress Manager is not that savy, you'll have to do things manually. Im not quite sure of this, but you could connect to your xpress server through your VBExpress and create your table there. The VS IDE provides more tools on handling database basic operations (eg. create tables) but if you want a more robust tool, then you'll have to download a higher version of SQL Server w/c is SQLServer CTP. It could be downloaded on the microsoft site...

     

    cheers,

    Paul June A. Domag



  • dOUbleOfour

    Did you ever solve this I have the same problem!!
  • Corny

    Jay:

    Thanks for your reply. To answer your questions ...

    The database is new. Created in VB 2005 Express by clicking on Add New Item. Selecting SQL Database. Naming it to TestDB.mdf. Click Add. TestDB.mdf appear in the Database Explorer (with a red X next to it), and the Data Source Configuration Wizard window is displayed. I click Cancel on the Data Source Configuration Wizard.

    The connection string is : Data Source=.\SQLEXPRESS;AttachDbFilename=D:\Logger64\Logger64\Logger64\TestDB.mdf;Integrated Security=True;User Instance=True

    Also, I just noticed ... If I click the Data Menu | Show Data Sources, I get an error message "Operation failed Only True Type fonts are supported. This is not a True Type font." :)

    Does this help

    Thanks,


  • Creating Tables with sql express