Showing posts with label structure. Show all posts
Showing posts with label structure. Show all posts

Friday, March 23, 2012

Getting SQL database structure from here to there

I'm sure there is a simple way to do this but I cannot think of it.
I have an ASP.NET application that I am publishing to a webhost. I have chosen to use FTP to copy my files (aspx, etc.). They work as far as links etc. Now, the next step is to create my SQL database on their server as they instruct, which I have done in name only. (Oh, if it makes a difference, I access the hosting service using Plesk control panel.) Is there any simple way to get my database structure from my PC to the host server? All responses welcome. Thanks.You might be able to ftp the actual raw mdf/ldf files up to the server, then attach these files to your db.
|||Thanks a ton. Thatwould be the perfect solution. Unfortunately, I don't see any kind of access to the attach command on their control panel. I will check again though. What about running scripts to create the tables, stored procedures, views etc.? Do you think that could work?|||Ok I think I misunderstood you...if you only need the schema (and notthe data itself) then you can script out the database an an .sql fileand then execute the resulting sql code on your hosting server and theschema will be created.
|||If you need to script the Data you can try my tool SQL Inserter. Its on GotDotnet
http://www.gotdotnet.com/workspaces/workspace.aspx?id=17ec0d2c-c29a-4eb3-83d5-b1c58bb32a78
Mathias|||

Thanks to everyone for responding. The script method seems to be the best one for me and is working so far.

Getting size of table

Hello there
IS there a way to know a size of parent table? (structure and data)I don't know what you mean by "parent table" but have you tried:
EXEC sp_spaceused 'tablename';
"Roy Goldhammer" <roy@.hotmail.com> wrote in message
news:uZZOE4RbGHA.472@.TK2MSFTNGP04.phx.gbl...
> Hello there
> IS there a way to know a size of parent table? (structure and data)
>

Wednesday, March 21, 2012

Getting rid of the identity column

Is there any way to alter a table column to remove the identity flag? Or create a table from another table structure without carrying over the identity flag?. A little backgroud:

I'm trying to create TSQL that appends multiple tables or queries (from separate DBs) that have the identical structure. This code will be generic and will not know the structure of the tables it is joining.

I created loop that uses the "select * into temp from table1" syntax to get create the table with the right table structure. All subsequent loops use the "insert * from table2 into temp" syntax.

The problem is that each table has an identity column (usually but not always called rowid) that overlaps with the other tables. When I run the program, I get the error:

"An explicit value for the identity column in table 'Temp' can only be specified when a column list is used and IDENTITY_INSERT is ON."

I tried using the Identity_insert TEMP ON but that didn't do anything.

Any ideas would be appreciated.you need to set the identity _insert on and use a column list

insert tbl (col1, col2, col3, ...)
select col1, col2, col3, ... from tbl2

fortunately this is quite easy

declare @.s varchar(4000)
select @.s = coalesce(@.s + ',','') + name
from syscolumns
where id = object_id(@.tblname)

this will give the column list - just use it in the insert and select.