Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
KarinsDad
Starting Member
17 Posts |
Posted - 2002-05-08 : 12:29:43
|
| 1) How do you replicate a database across the net onto a client system? Not the records, but the tables, triggers, stored procedures, relationships, jobs, schedules, etc.?2) How do you create an SQL file (via Enterprise Manager or some other tool, not manually) so that you can put it on a floppy and replicate a database on a standalone system?3) Access has a AutoNumbering feature. Does SQL Server have the same thing and if so, how do you set it up on a numeric field?Thanks. |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2002-05-08 : 12:43:08
|
| 1 & 2 . . . replicate is the a loaded word . . . in sql server REPLICATION is a different thing than what you are talking about. You need to look into BACKUP and RESTORE (possible WITH MOVE) or sp_detatch_db / sp_attach_db. Alternativly, in SQL 2k there is a DTS task that moves sql objecst (can't remember exactly what it is called).3. IDENTITY - create table #blah( blah int identity(1,1))<O> |
 |
|
|
KarinsDad
Starting Member
17 Posts |
Posted - 2002-05-08 : 13:35:57
|
| I thought backup and restore were for the actual data.I found a "Generate SQL Scripts" under "All Tasks" that does most of #2, but I do not think it can be used for jobs or schedules. Is there a way to generate the SQL for jobs and schedules?So, on #3, to do this within the Enterprise Manager "Design Table", you just check the Identity check box and optionally give it an Identity Seed and Increment. Correct? |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-05-08 : 13:46:50
|
| #3 is correct, the Identity seed and increment both default to 1, change them to suit your needs.Replication is used to synchronize both structure AND data between replica databases, mostly it is used for data sync however. If you only need the structure of a database, then just generate the script files for it and save them on a floppy. You can then run the .SQL files using osql or Query Analyzer and it will create the database and objects for you. There won't be any data though. If you also need data, then BACKUP/RESTORE or detach/attach is a good way to do it.Jobs and their schedules are stored in the msdb database. Take a look at the system procedures for jobs: sp_add_job, sp_add_jobschedule, sp_add_jobstep etc. You can use them to create all of your jobs and such, and keep them in a .SQL file that you can include on the floppy, then run on the client's machine. You'd have to write some code to extract existing jobs from msdb and create the SQL for them.Also take a look at SQL-DMO (it's documented in Books Online, under "Building SQL Server Applications") it has a full object model that includes Job objects and all of their related objects too. There is a Script method that will probably generate the necessary SQL script. |
 |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2002-05-08 : 15:10:51
|
quote: I thought backup and restore were for the actual data.
I'm sorry, I read that, but by the time I penned the reply . . . I forgot . . .Only other thing to add is that (at least in SQL 7 sp3) I can right click in em and a job and script it 'all tasks' sub menue . . . this captures the job and the schedulesEDIT: You know the much easier option is to just 'Get Latest Version' from SourceSafe or whatever your source control software . . . (look into it )<O>Edited by - Page47 on 05/08/2002 15:12:12 |
 |
|
|
|
|
|
|
|