Thursday, May 16, 2013

[SQL Server] Restore with Replace, but keep old views?

[SQL Server] Restore with Replace, but keep old views?


Restore with Replace, but keep old views?

Posted: 16 May 2013 04:22 AM PDT

Hello,Just a quick question - I have two DBs - "DB 1" and "DB 2" DB 1 is, essentially, the production DB. DB 2 is, essentially, a reporting environment.I'm trying to get replication working, but in the meantime, I would like to take the newer data from DB 1 and move it to DB 2, but I would like to keep some custom views that have been created on DB 2.What's the least painful way to do this?Ordinarily, I just use the latest backup for DB 1 and restore with replace on DB 2. But, that's going to drop all the custom views located there, right?To save time, I'd rather not have to write scripts to manually pull data from one DB and write it to the other...Thanks.

How to choose which instance of SQL Server I am using

Posted: 06 Apr 2013 05:16 AM PDT

I'm having a hard time figuring this out, and it's a very basic question, so maybe I'm just having a hard time understanding the basics of this concept. Any help would be greatly appreciated!I previously had SQL Server Express 2008 set up on my home computer (windows 7), and I've been using that for a while.I wanted to start working through a book on BI, so I installed the evaluation version of SQL Server Enterprise Edition 2008. It wouldn't let me upgrade Express (it was getting an error) so i instead chose to install a second instance of SQL Server (called MSSQLSERVER) on the machine.My basic question is, how do I control which instance I am using? As I go through my exercises with this BI book, do I need to make sure I am using the Enterprise version and not the Express? If so, how do i do that? In my programs menu, I only see one version of SQL Server 2008. When i open it, I am still able to connect using SSMS and see all the databases I saw before. It connects to this server:localhost\sqlexpressI know that both instances are installed on my machine, because if I go to Run > services.mscI see services for both instances, one called SQLEXPRESS and the other called MSSQLSERVERUsing SSMS, I have tried to connect to localhost\sqlexpress\mssqlserverand localhost\mssqlserverhowever, neither of these will connect. How do I connect to this second instance?Thanks very much.

Incorrect Syntax near 'MAXSIZE'

Posted: 15 May 2013 10:18 PM PDT

I am getting a syntax error when trying to create a database. Here is my code:[code] Create database ToddTestDB On Primary( Name = N'ToddTestDB',FILENAME = N'C:\Program Files\Microsoft SQLServer\MSSQL10.MSSQLSERVER\MSSQL\DATA\ToddTestDB.MDF' , Size = 3072KBMAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )LOG ON( NAME = N'ToddTestDB_log',FILENAME = N'C:\Program Files\Microsoft SQLServer\MSSQL10.MSSQLSERVER\MSSQL\DATA\ToddTestDB_log.ldf' ,SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10% COLLATE SQL_LATIN1_GENERAL_CP1_CI_AS GO [/code]Everything looks fine to me but it says:Msg 102, Level 15, State 1, Line 6Incorrect syntax near 'MAXSIZE'.

No comments:

Post a Comment

Search This Blog