Create a database with one table on the host

A

AAaron123

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
 
L

Lloyd Sheen

sloan said:
What is "The Host"?

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
 
A

AAaron123

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
 
B

bruce barker

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)
 
H

Hillbilly

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...
 
A

AAaron123

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
 
A

AAaron123

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
 
B

bruce barker

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)
 
A

AAaron123

Thank you

bruce barker said:
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,771
Messages
2,569,587
Members
45,099
Latest member
AmbrosePri
Top