Create a database with one table on the host

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • AAaron123

    #1

    Create a database with one table on the host

    I want to create a database with one table on the host.

    I can't user SQL Server Management Studio to do it so I guess I have to do
    it programmaticall y.

    I have in mind that in the session start (or maybe application start would
    be better) I'd check to see it the database exists and if not create it.

    The problem is that I have no idea how to do that.

    Can you point to documentation of maybe show an example of how to do that?


    Thanks


  • sloan

    #2
    Re: Create a database with one table on the host

    What is "The Host"?


    "AAaron123" <aaaron123@road runner.comwrote in message
    news:OG0GXhaSJH A.4084@TK2MSFTN GP04.phx.gbl...
    >I want to create a database with one table on the host.
    >
    I can't user SQL Server Management Studio to do it so I guess I have to do
    it programmaticall y.
    >
    I have in mind that in the session start (or maybe application start would
    be better) I'd check to see it the database exists and if not create it.
    >
    The problem is that I have no idea how to do that.
    >
    Can you point to documentation of maybe show an example of how to do that?
    >
    >
    Thanks
    >

    Comment

    • Lloyd Sheen

      #3
      Re: Create a database with one table on the host


      "sloan" <sloan@ipass.ne twrote in message
      news:%23Jo8QjaS JHA.1144@TK2MSF TNGP05.phx.gbl. ..
      What is "The Host"?
      >
      >
      "AAaron123" <aaaron123@road runner.comwrote in message
      news:OG0GXhaSJH A.4084@TK2MSFTN GP04.phx.gbl...
      >>I want to create a database with one table on the host.
      >>
      >I can't user SQL Server Management Studio to do it so I guess I have to
      >do it programmaticall y.
      >>
      >I have in mind that in the session start (or maybe application start
      >would be better) I'd check to see it the database exists and if not
      >create it.
      >>
      >The problem is that I have no idea how to do that.
      >>
      >Can you point to documentation of maybe show an example of how to do
      >that?
      >>
      >>
      >Thanks
      >>
      >
      >
      If you have SSMS on your development workstation you can do the following:

      Create your database on your test SQL Server.
      Create your table on your test SQL Server
      Script the database using SSMS (create option)
      Script the table using SSMS (create option)

      Use those scripts thru ADO.NET to create the database first and then the
      table. You will also have to ATTACH the newly created database. Also note
      that the script created will have lots of GO's. You will have to execute
      each set of commands between the GO's as SQL Server does not know what GO
      is.

      You might also have to set permissions and ensure that the location of the
      database file is valid and accessable by SQL Server.

      Hope this helps
      LS

      Comment

      • AAaron123

        #4
        Re: Create a database with one table on the host

        Laneware free
        "sloan" <sloan@ipass.ne twrote in message
        news:%23Jo8QjaS JHA.1144@TK2MSF TNGP05.phx.gbl. ..
        What is "The Host"?
        >
        >
        "AAaron123" <aaaron123@road runner.comwrote in message
        news:OG0GXhaSJH A.4084@TK2MSFTN GP04.phx.gbl...
        >>I want to create a database with one table on the host.
        >>
        >I can't user SQL Server Management Studio to do it so I guess I have to
        >do it programmaticall y.
        >>
        >I have in mind that in the session start (or maybe application start
        >would be better) I'd check to see it the database exists and if not
        >create it.
        >>
        >The problem is that I have no idea how to do that.
        >>
        >Can you point to documentation of maybe show an example of how to do
        >that?
        >>
        >>
        >Thanks
        >>
        >
        >

        Comment

        • AAaron123

          #5
          Re: Create a database with one table on the host

          Wow!

          I was expecting that I could programmaticall y connect and then create with a
          set of sql commands.


          I should have mentioned that I have SQL Server 2008, the host has SQL
          Express 2005 ( I have the free service, he has better for payers).

          If the SQL Server 2008 script is OK to use on SQL Express 2005 (is it?) can
          I just remove the Go's from the script?

          Thanks for the info


          "Lloyd Sheen" <a@b.cwrote in message
          news:OdxVR4aSJH A.3604@TK2MSFTN GP03.phx.gbl...
          >
          "sloan" <sloan@ipass.ne twrote in message
          news:%23Jo8QjaS JHA.1144@TK2MSF TNGP05.phx.gbl. ..
          >What is "The Host"?
          >>
          >>
          >"AAaron123" <aaaron123@road runner.comwrote in message
          >news:OG0GXhaSJ HA.4084@TK2MSFT NGP04.phx.gbl.. .
          >>>I want to create a database with one table on the host.
          >>>
          >>I can't user SQL Server Management Studio to do it so I guess I have to
          >>do it programmaticall y.
          >>>
          >>I have in mind that in the session start (or maybe application start
          >>would be better) I'd check to see it the database exists and if not
          >>create it.
          >>>
          >>The problem is that I have no idea how to do that.
          >>>
          >>Can you point to documentation of maybe show an example of how to do
          >>that?
          >>>
          >>>
          >>Thanks
          >>>
          >>
          >>
          >
          If you have SSMS on your development workstation you can do the following:
          >
          Create your database on your test SQL Server.
          Create your table on your test SQL Server
          Script the database using SSMS (create option)
          Script the table using SSMS (create option)
          >
          Use those scripts thru ADO.NET to create the database first and then the
          table. You will also have to ATTACH the newly created database. Also
          note that the script created will have lots of GO's. You will have to
          execute each set of commands between the GO's as SQL Server does not know
          what GO is.
          >
          You might also have to set permissions and ensure that the location of the
          database file is valid and accessable by SQL Server.
          >
          Hope this helps
          LS

          Comment

          • =?Utf-8?B?YnJ1Y2UgYmFya2Vy?=

            #6
            Re: Create a database with one table on the host

            unless you have the admin access to sqlserver you can not create a database.
            most likely your isp only allows an autoconnect (via a connection string) to
            a database you upload (app_data folder). this means you create the database
            locally, disconnect it then upload.

            -- bruce (sqlwork.com)


            "AAaron123" wrote:
            Wow!
            >
            I was expecting that I could programmaticall y connect and then create with a
            set of sql commands.
            >
            >
            I should have mentioned that I have SQL Server 2008, the host has SQL
            Express 2005 ( I have the free service, he has better for payers).
            >
            If the SQL Server 2008 script is OK to use on SQL Express 2005 (is it?) can
            I just remove the Go's from the script?
            >
            Thanks for the info
            >
            >
            "Lloyd Sheen" <a@b.cwrote in message
            news:OdxVR4aSJH A.3604@TK2MSFTN GP03.phx.gbl...

            "sloan" <sloan@ipass.ne twrote in message
            news:%23Jo8QjaS JHA.1144@TK2MSF TNGP05.phx.gbl. ..
            What is "The Host"?
            >
            >
            "AAaron123" <aaaron123@road runner.comwrote in message
            news:OG0GXhaSJH A.4084@TK2MSFTN GP04.phx.gbl...
            >>I want to create a database with one table on the host.
            >>
            >I can't user SQL Server Management Studio to do it so I guess I have to
            >do it programmaticall y.
            >>
            >I have in mind that in the session start (or maybe application start
            >would be better) I'd check to see it the database exists and if not
            >create it.
            >>
            >The problem is that I have no idea how to do that.
            >>
            >Can you point to documentation of maybe show an example of how to do
            >that?
            >>
            >>
            >Thanks
            >>
            >
            >
            If you have SSMS on your development workstation you can do the following:

            Create your database on your test SQL Server.
            Create your table on your test SQL Server
            Script the database using SSMS (create option)
            Script the table using SSMS (create option)

            Use those scripts thru ADO.NET to create the database first and then the
            table. You will also have to ATTACH the newly created database. Also
            note that the script created will have lots of GO's. You will have to
            execute each set of commands between the GO's as SQL Server does not know
            what GO is.

            You might also have to set permissions and ensure that the location of the
            database file is valid and accessable by SQL Server.

            Hope this helps
            LS
            >
            >
            >

            Comment

            • Hillbilly

              #7
              Re: Create a database with one table on the host

              If all you need is one table it is kind of over-kill to even use SQL Server
              when one or more XML files can replace the entire notion of using a
              database.

              For example, write one XML file to contain the "Primary Key" and another XML
              file containing the data for each record. You could put all data into a
              single file too. Its something to consider...



              "AAaron123" <aaaron123@road runner.comwrote in message
              news:OG0GXhaSJH A.4084@TK2MSFTN GP04.phx.gbl...
              >I want to create a database with one table on the host.
              >
              I can't user SQL Server Management Studio to do it so I guess I have to do
              it programmaticall y.
              >
              I have in mind that in the session start (or maybe application start would
              be better) I'd check to see it the database exists and if not create it.
              >
              The problem is that I have no idea how to do that.
              >
              Can you point to documentation of maybe show an example of how to do that?
              >
              >
              Thanks
              >

              Comment

              • AAaron123

                #8
                Re: Create a database with one table on the host

                I'm probably making a mountain out of a mole hill.
                All I want to do is maintain a count of how many visitors the site has had.
                I've seen others use a database.

                Maybe a question as to how to approach this would be a better question.



                Thanks


                "Hillbilly" <somebody@somew here.comwrote in message
                news:%23YckTgcS JHA.5860@TK2MSF TNGP02.phx.gbl. ..
                If all you need is one table it is kind of over-kill to even use SQL
                Server when one or more XML files can replace the entire notion of using a
                database.
                >
                For example, write one XML file to contain the "Primary Key" and another
                XML file containing the data for each record. You could put all data into
                a single file too. Its something to consider...
                >
                >
                >
                "AAaron123" <aaaron123@road runner.comwrote in message
                news:OG0GXhaSJH A.4084@TK2MSFTN GP04.phx.gbl...
                >>I want to create a database with one table on the host.
                >>
                >I can't user SQL Server Management Studio to do it so I guess I have to
                >do it programmaticall y.
                >>
                >I have in mind that in the session start (or maybe application start
                >would be better) I'd check to see it the database exists and if not
                >create it.
                >>
                >The problem is that I have no idea how to do that.
                >>
                >Can you point to documentation of maybe show an example of how to do
                >that?
                >>
                >>
                >Thanks
                >>
                >

                Comment

                • AAaron123

                  #9
                  Re: Create a database with one table on the host

                  Thanks, I'd have to install sql express 2005 when I have already have sql
                  server 2008. Not sure if doing that would upset sql server 2008 or vs 2008.


                  thanks for the info

                  "bruce barker" <brucebarker@di scussions.micro soft.comwrote in message
                  news:1D6E4CAD-3A2B-4ACD-8596-23E4354F692F@mi crosoft.com...
                  unless you have the admin access to sqlserver you can not create a
                  database.
                  most likely your isp only allows an autoconnect (via a connection string)
                  to
                  a database you upload (app_data folder). this means you create the
                  database
                  locally, disconnect it then upload.
                  >
                  -- bruce (sqlwork.com)
                  >
                  >
                  "AAaron123" wrote:
                  >
                  >Wow!
                  >>
                  >I was expecting that I could programmaticall y connect and then create
                  >with a
                  >set of sql commands.
                  >>
                  >>
                  >I should have mentioned that I have SQL Server 2008, the host has SQL
                  >Express 2005 ( I have the free service, he has better for payers).
                  >>
                  >If the SQL Server 2008 script is OK to use on SQL Express 2005 (is it?)
                  >can
                  >I just remove the Go's from the script?
                  >>
                  >Thanks for the info
                  >>
                  >>
                  >"Lloyd Sheen" <a@b.cwrote in message
                  >news:OdxVR4aSJ HA.3604@TK2MSFT NGP03.phx.gbl.. .
                  >
                  "sloan" <sloan@ipass.ne twrote in message
                  news:%23Jo8QjaS JHA.1144@TK2MSF TNGP05.phx.gbl. ..
                  >What is "The Host"?
                  >>
                  >>
                  >"AAaron123" <aaaron123@road runner.comwrote in message
                  >news:OG0GXhaSJ HA.4084@TK2MSFT NGP04.phx.gbl.. .
                  >>>I want to create a database with one table on the host.
                  >>>
                  >>I can't user SQL Server Management Studio to do it so I guess I have
                  >>to
                  >>do it programmaticall y.
                  >>>
                  >>I have in mind that in the session start (or maybe application start
                  >>would be better) I'd check to see it the database exists and if not
                  >>create it.
                  >>>
                  >>The problem is that I have no idea how to do that.
                  >>>
                  >>Can you point to documentation of maybe show an example of how to do
                  >>that?
                  >>>
                  >>>
                  >>Thanks
                  >>>
                  >>
                  >>
                  >
                  If you have SSMS on your development workstation you can do the
                  following:
                  >
                  Create your database on your test SQL Server.
                  Create your table on your test SQL Server
                  Script the database using SSMS (create option)
                  Script the table using SSMS (create option)
                  >
                  Use those scripts thru ADO.NET to create the database first and then
                  the
                  table. You will also have to ATTACH the newly created database. Also
                  note that the script created will have lots of GO's. You will have to
                  execute each set of commands between the GO's as SQL Server does not
                  know
                  what GO is.
                  >
                  You might also have to set permissions and ensure that the location of
                  the
                  database file is valid and accessable by SQL Server.
                  >
                  Hope this helps
                  LS
                  >>
                  >>
                  >>

                  Comment

                  • bruce barker

                    #10
                    Re: Create a database with one table on the host

                    sqlexpress 2005 and/or sqlserver 2005 will run side by side with
                    sqlserver 2008. I'd probably just install sqlserver 2005. you want a
                    version to match your isp. your other option is to use virtual machines.

                    -- bruce (sqlwork.com)


                    AAaron123 wrote:
                    Thanks, I'd have to install sql express 2005 when I have already have sql
                    server 2008. Not sure if doing that would upset sql server 2008 or vs 2008.
                    >
                    >
                    thanks for the info
                    >
                    "bruce barker" <brucebarker@di scussions.micro soft.comwrote in message
                    news:1D6E4CAD-3A2B-4ACD-8596-23E4354F692F@mi crosoft.com...
                    >unless you have the admin access to sqlserver you can not create a
                    >database.
                    >most likely your isp only allows an autoconnect (via a connection string)
                    >to
                    >a database you upload (app_data folder). this means you create the
                    >database
                    >locally, disconnect it then upload.
                    >>
                    >-- bruce (sqlwork.com)
                    >>
                    >>
                    >"AAaron123" wrote:
                    >>
                    >>Wow!
                    >>>
                    >>I was expecting that I could programmaticall y connect and then create
                    >>with a
                    >>set of sql commands.
                    >>>
                    >>>
                    >>I should have mentioned that I have SQL Server 2008, the host has SQL
                    >>Express 2005 ( I have the free service, he has better for payers).
                    >>>
                    >>If the SQL Server 2008 script is OK to use on SQL Express 2005 (is it?)
                    >>can
                    >>I just remove the Go's from the script?
                    >>>
                    >>Thanks for the info
                    >>>
                    >>>
                    >>"Lloyd Sheen" <a@b.cwrote in message
                    >>news:OdxVR4aS JHA.3604@TK2MSF TNGP03.phx.gbl. ..
                    >>>"sloan" <sloan@ipass.ne twrote in message
                    >>>news:%23Jo8Q jaSJHA.1144@TK2 MSFTNGP05.phx.g bl...
                    >>>>What is "The Host"?
                    >>>>>
                    >>>>>
                    >>>>"AAaron12 3" <aaaron123@road runner.comwrote in message
                    >>>>news:OG0GXh aSJHA.4084@TK2M SFTNGP04.phx.gb l...
                    >>>>>I want to create a database with one table on the host.
                    >>>>>>
                    >>>>>I can't user SQL Server Management Studio to do it so I guess I have
                    >>>>>to
                    >>>>>do it programmaticall y.
                    >>>>>>
                    >>>>>I have in mind that in the session start (or maybe application start
                    >>>>>would be better) I'd check to see it the database exists and if not
                    >>>>>create it.
                    >>>>>>
                    >>>>>The problem is that I have no idea how to do that.
                    >>>>>>
                    >>>>>Can you point to documentation of maybe show an example of how to do
                    >>>>>that?
                    >>>>>>
                    >>>>>>
                    >>>>>Thanks
                    >>>>>>
                    >>>>>
                    >>>If you have SSMS on your development workstation you can do the
                    >>>following:
                    >>>>
                    >>>Create your database on your test SQL Server.
                    >>>Create your table on your test SQL Server
                    >>>Script the database using SSMS (create option)
                    >>>Script the table using SSMS (create option)
                    >>>>
                    >>>Use those scripts thru ADO.NET to create the database first and then
                    >>>the
                    >>>table. You will also have to ATTACH the newly created database. Also
                    >>>note that the script created will have lots of GO's. You will have to
                    >>>execute each set of commands between the GO's as SQL Server does not
                    >>>know
                    >>>what GO is.
                    >>>>
                    >>>You might also have to set permissions and ensure that the location of
                    >>>the
                    >>>database file is valid and accessable by SQL Server.
                    >>>>
                    >>>Hope this helps
                    >>>LS
                    >>>
                    >>>
                    >
                    >

                    Comment

                    • AAaron123

                      #11
                      Re: Create a database with one table on the host

                      Thank you

                      "bruce barker" <nospam@nospam. comwrote in message
                      news:OlOVsUfSJH A.1960@TK2MSFTN GP04.phx.gbl...
                      sqlexpress 2005 and/or sqlserver 2005 will run side by side with sqlserver
                      2008. I'd probably just install sqlserver 2005. you want a version to
                      match your isp. your other option is to use virtual machines.
                      >
                      -- bruce (sqlwork.com)
                      >
                      >
                      AAaron123 wrote:
                      >Thanks, I'd have to install sql express 2005 when I have already have sql
                      >server 2008. Not sure if doing that would upset sql server 2008 or vs
                      >2008.
                      >>
                      >>
                      >thanks for the info
                      >>
                      >"bruce barker" <brucebarker@di scussions.micro soft.comwrote in message
                      >news:1D6E4CA D-3A2B-4ACD-8596-23E4354F692F@mi crosoft.com...
                      >>unless you have the admin access to sqlserver you can not create a
                      >>database.
                      >>most likely your isp only allows an autoconnect (via a connection
                      >>string) to
                      >>a database you upload (app_data folder). this means you create the
                      >>database
                      >>locally, disconnect it then upload.
                      >>>
                      >>-- bruce (sqlwork.com)
                      >>>
                      >>>
                      >>"AAaron123" wrote:
                      >>>
                      >>>Wow!
                      >>>>
                      >>>I was expecting that I could programmaticall y connect and then create
                      >>>with a
                      >>>set of sql commands.
                      >>>>
                      >>>>
                      >>>I should have mentioned that I have SQL Server 2008, the host has SQL
                      >>>Express 2005 ( I have the free service, he has better for payers).
                      >>>>
                      >>>If the SQL Server 2008 script is OK to use on SQL Express 2005 (is it?)
                      >>>can
                      >>>I just remove the Go's from the script?
                      >>>>
                      >>>Thanks for the info
                      >>>>
                      >>>>
                      >>>"Lloyd Sheen" <a@b.cwrote in message
                      >>>news:OdxVR4a SJHA.3604@TK2MS FTNGP03.phx.gbl ...
                      >>>>"sloan" <sloan@ipass.ne twrote in message
                      >>>>news:%23Jo8 QjaSJHA.1144@TK 2MSFTNGP05.phx. gbl...
                      >>>>>What is "The Host"?
                      >>>>>>
                      >>>>>>
                      >>>>>"AAaron123 " <aaaron123@road runner.comwrote in message
                      >>>>>news:OG0GX haSJHA.4084@TK2 MSFTNGP04.phx.g bl...
                      >>>>>>I want to create a database with one table on the host.
                      >>>>>>>
                      >>>>>>I can't user SQL Server Management Studio to do it so I guess I have
                      >>>>>>to
                      >>>>>>do it programmaticall y.
                      >>>>>>>
                      >>>>>>I have in mind that in the session start (or maybe application start
                      >>>>>>would be better) I'd check to see it the database exists and if not
                      >>>>>>create it.
                      >>>>>>>
                      >>>>>>The problem is that I have no idea how to do that.
                      >>>>>>>
                      >>>>>>Can you point to documentation of maybe show an example of how to do
                      >>>>>>that?
                      >>>>>>>
                      >>>>>>>
                      >>>>>>Thanks
                      >>>>>>>
                      >>>>>>
                      >>>>If you have SSMS on your development workstation you can do the
                      >>>>following :
                      >>>>>
                      >>>>Create your database on your test SQL Server.
                      >>>>Create your table on your test SQL Server
                      >>>>Script the database using SSMS (create option)
                      >>>>Script the table using SSMS (create option)
                      >>>>>
                      >>>>Use those scripts thru ADO.NET to create the database first and then
                      >>>>the
                      >>>>table. You will also have to ATTACH the newly created database. Also
                      >>>>note that the script created will have lots of GO's. You will have to
                      >>>>execute each set of commands between the GO's as SQL Server does not
                      >>>>know
                      >>>>what GO is.
                      >>>>>
                      >>>>You might also have to set permissions and ensure that the location of
                      >>>>the
                      >>>>database file is valid and accessable by SQL Server.
                      >>>>>
                      >>>>Hope this helps
                      >>>>LS
                      >>>>
                      >>>>
                      >>

                      Comment

                      Working...