Connecting Tech Pros Worldwide Forums | Help | Site Map

Create a database with one table on the host

AAaron123
Guest
 
Posts: n/a
#1: Nov 18 '08
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 programmatically.

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
Guest
 
Posts: n/a
#2: Nov 18 '08

re: Create a database with one table on the host


What is "The Host"?


"AAaron123" <aaaron123@roadrunner.comwrote in message
news:OG0GXhaSJHA.4084@TK2MSFTNGP04.phx.gbl...
Quote:
>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 programmatically.
>
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
>

Lloyd Sheen
Guest
 
Posts: n/a
#3: Nov 18 '08

re: Create a database with one table on the host



"sloan" <sloan@ipass.netwrote in message
news:%23Jo8QjaSJHA.1144@TK2MSFTNGP05.phx.gbl...
Quote:
What is "The Host"?
>
>
"AAaron123" <aaaron123@roadrunner.comwrote in message
news:OG0GXhaSJHA.4084@TK2MSFTNGP04.phx.gbl...
Quote:
>>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 programmatically.
>>
>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

AAaron123
Guest
 
Posts: n/a
#4: Nov 18 '08

re: Create a database with one table on the host


Laneware free
"sloan" <sloan@ipass.netwrote in message
news:%23Jo8QjaSJHA.1144@TK2MSFTNGP05.phx.gbl...
Quote:
What is "The Host"?
>
>
"AAaron123" <aaaron123@roadrunner.comwrote in message
news:OG0GXhaSJHA.4084@TK2MSFTNGP04.phx.gbl...
Quote:
>>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 programmatically.
>>
>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
>>
>
>

AAaron123
Guest
 
Posts: n/a
#5: Nov 18 '08

re: Create a database with one table on the host


Wow!

I was expecting that I could programmatically 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:OdxVR4aSJHA.3604@TK2MSFTNGP03.phx.gbl...
Quote:
>
"sloan" <sloan@ipass.netwrote in message
news:%23Jo8QjaSJHA.1144@TK2MSFTNGP05.phx.gbl...
Quote:
>What is "The Host"?
>>
>>
>"AAaron123" <aaaron123@roadrunner.comwrote in message
>news:OG0GXhaSJHA.4084@TK2MSFTNGP04.phx.gbl...
Quote:
>>>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 programmatically.
>>>
>>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

=?Utf-8?B?YnJ1Y2UgYmFya2Vy?=
Guest
 
Posts: n/a
#6: Nov 18 '08

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:
Quote:
Wow!
>
I was expecting that I could programmatically 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:OdxVR4aSJHA.3604@TK2MSFTNGP03.phx.gbl...
Quote:

"sloan" <sloan@ipass.netwrote in message
news:%23Jo8QjaSJHA.1144@TK2MSFTNGP05.phx.gbl...
Quote:
What is "The Host"?
>
>
"AAaron123" <aaaron123@roadrunner.comwrote in message
news:OG0GXhaSJHA.4084@TK2MSFTNGP04.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 programmatically.
>>
>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
>
>
>
Hillbilly
Guest
 
Posts: n/a
#7: Nov 18 '08

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@roadrunner.comwrote in message
news:OG0GXhaSJHA.4084@TK2MSFTNGP04.phx.gbl...
Quote:
>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 programmatically.
>
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
>
AAaron123
Guest
 
Posts: n/a
#8: Nov 18 '08

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@somewhere.comwrote in message
news:%23YckTgcSJHA.5860@TK2MSFTNGP02.phx.gbl...
Quote:
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@roadrunner.comwrote in message
news:OG0GXhaSJHA.4084@TK2MSFTNGP04.phx.gbl...
Quote:
>>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 programmatically.
>>
>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
>>
>

AAaron123
Guest
 
Posts: n/a
#9: Nov 18 '08

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@discussions.microsoft.comwrote in message
news:1D6E4CAD-3A2B-4ACD-8596-23E4354F692F@microsoft.com...
Quote:
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:
>
Quote:
>Wow!
>>
>I was expecting that I could programmatically 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:OdxVR4aSJHA.3604@TK2MSFTNGP03.phx.gbl...
Quote:
>
"sloan" <sloan@ipass.netwrote in message
news:%23Jo8QjaSJHA.1144@TK2MSFTNGP05.phx.gbl...
>What is "The Host"?
>>
>>
>"AAaron123" <aaaron123@roadrunner.comwrote in message
>news:OG0GXhaSJHA.4084@TK2MSFTNGP04.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 programmatically.
>>>
>>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
>>
>>
>>

bruce barker
Guest
 
Posts: n/a
#10: Nov 19 '08

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:
Quote:
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@discussions.microsoft.comwrote in message
news:1D6E4CAD-3A2B-4ACD-8596-23E4354F692F@microsoft.com...
Quote:
>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:
>>
Quote:
>>Wow!
>>>
>>I was expecting that I could programmatically 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:OdxVR4aSJHA.3604@TK2MSFTNGP03.phx.gbl...
>>>"sloan" <sloan@ipass.netwrote in message
>>>news:%23Jo8QjaSJHA.1144@TK2MSFTNGP05.phx.gbl. ..
>>>>What is "The Host"?
>>>>>
>>>>>
>>>>"AAaron123" <aaaron123@roadrunner.comwrote in message
>>>>news:OG0GXhaSJHA.4084@TK2MSFTNGP04.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 programmatically.
>>>>>>
>>>>>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
>>>
>>>
>
>
AAaron123
Guest
 
Posts: n/a
#11: Nov 19 '08

re: Create a database with one table on the host


Thank you

"bruce barker" <nospam@nospam.comwrote in message
news:OlOVsUfSJHA.1960@TK2MSFTNGP04.phx.gbl...
Quote:
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:
Quote:
>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@discussions.microsoft.comwrote in message
>news:1D6E4CAD-3A2B-4ACD-8596-23E4354F692F@microsoft.com...
Quote:
>>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 programmatically 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:OdxVR4aSJHA.3604@TK2MSFTNGP03.phx.gbl...
>>>>"sloan" <sloan@ipass.netwrote in message
>>>>news:%23Jo8QjaSJHA.1144@TK2MSFTNGP05.phx.gbl.. .
>>>>>What is "The Host"?
>>>>>>
>>>>>>
>>>>>"AAaron123" <aaaron123@roadrunner.comwrote in message
>>>>>news:OG0GXhaSJHA.4084@TK2MSFTNGP04.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 programmatically.
>>>>>>>
>>>>>>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
>>>>
>>>>
>>
Closed Thread