By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,837 Members | 1,357 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,837 IT Pros & Developers. It's quick & easy.

Create a database with one table on the host

P: n/a
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
Nov 18 '08 #1
Share this Question
Share on Google+
10 Replies


P: n/a
What is "The Host"?
"AAaron123" <aa*******@roadrunner.comwrote in message
news:OG**************@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

Nov 18 '08 #2

P: n/a

"sloan" <sl***@ipass.netwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
What is "The Host"?
"AAaron123" <aa*******@roadrunner.comwrote in message
news:OG**************@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

Nov 18 '08 #3

P: n/a
Laneware free
"sloan" <sl***@ipass.netwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
What is "The Host"?
"AAaron123" <aa*******@roadrunner.comwrote in message
news:OG**************@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


Nov 18 '08 #4

P: n/a
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:Od**************@TK2MSFTNGP03.phx.gbl...
>
"sloan" <sl***@ipass.netwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>What is "The Host"?
"AAaron123" <aa*******@roadrunner.comwrote in message
news:OG**************@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

Nov 18 '08 #5

P: n/a
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:Od**************@TK2MSFTNGP03.phx.gbl...

"sloan" <sl***@ipass.netwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
What is "The Host"?
"AAaron123" <aa*******@roadrunner.comwrote in message
news:OG**************@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


Nov 18 '08 #6

P: n/a
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" <aa*******@roadrunner.comwrote in message
news:OG**************@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
Nov 18 '08 #7

P: n/a
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" <so******@somewhere.comwrote in message
news:%2****************@TK2MSFTNGP02.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" <aa*******@roadrunner.comwrote in message
news:OG**************@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

Nov 18 '08 #8

P: n/a
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" <br*********@discussions.microsoft.comwrote in message
news:1D**********************************@microsof t.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 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:Od**************@TK2MSFTNGP03.phx.gbl...
>
"sloan" <sl***@ipass.netwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
What is "The Host"?
"AAaron123" <aa*******@roadrunner.comwrote in message
news:OG**************@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



Nov 18 '08 #9

P: n/a
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" <br*********@discussions.microsoft.comwrote in message
news:1D**********************************@microsof t.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 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:Od**************@TK2MSFTNGP03.phx.gbl...
"sloan" <sl***@ipass.netwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl. ..
What is "The Host"?
>
>
"AAaron123" <aa*******@roadrunner.comwrote in message
news:OG**************@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


Nov 19 '08 #10

P: n/a
Thank you

"bruce barker" <no****@nospam.comwrote in message
news:Ol**************@TK2MSFTNGP04.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" <br*********@discussions.microsoft.comwrote in message
news:1D**********************************@microso ft.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 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:Od**************@TK2MSFTNGP03.phx.gbl...
"sloan" <sl***@ipass.netwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl.. .
>What is "The Host"?
>>
>>
>"AAaron123" <aa*******@roadrunner.comwrote in message
>news:OG**************@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

Nov 19 '08 #11

This discussion thread is closed

Replies have been disabled for this discussion.