Friday, October 1, 2010

Create view and force source tables to stay valid

In this example I have a table called dbo.customers with (FN,LN, address, Phone) columns

--creates the view
Create view vw_customers

as
--only two columns are selected (FN,LN)
Select FN, LN
from customers

with Schemabinding

So. If you attempt to drop the the customers table , SQL will return " can not drop table with reference."

Thursday, September 23, 2010

Report server web page is blank in Windows 2008 Server

localhost/reports is blank? You can not configure any new reports right?
are you using windows 2008 server?

If you answer yes to these questions than proceed to the next part below.

Well, right click on IE and run as administrator
or remove UAC in windows 2008.

Saturday, September 18, 2010

Moving? Tempdb is out of space

Moving Tempdb

In order to move the tempdb database, open SSMS and run the following query:

use master
go
Alter database tempdb modify file
(name = tempdev, filename = 'E:\Sqldata\tempdb.mdf')
go
Alter database tempdb modify file
(name = templog, filename = 'E:\Sqldata\templog.ldf')
Go

This command assumes that you are
moving the database files to E:\Sqldata directory

Monday, September 13, 2010

No mapping between account names and security IDs was done

SQL Server Setup has encountered the following error:
"No mapping between account names and security IDs was done."
"Error code 0x84BB0001."


  1. go to services not ms sql config manager
  2. change the service(s) to run under local services
  3. reboot

you probably demoted domain controller or changed accounts somehow

Tuesday, September 7, 2010

Can not start MS SQL Server 2005 because ERRORLOG full?

Things to do:

  1. Check the MS Sql server 2005 configuration tool and make sure MS SQL server is started
  2. restart the MS Sql Server service ( this will cycle ERRORLOG to errorlog.1)
  3. launch SSMS and exec sp_cycle_ERRORLOG (use master)

P.S check the ERRORLOG it may be a GIG is size (Sql won't start).

Tuesday, August 31, 2010

Transaction logs growing out of control?

login to SSMS and click new query :
backup log adventureworks with truncate_only

next, right click database adventureworks>tasks> shrink> files>file type > logs> click ok
thats it --only ms SQL server 2005

Sunday, August 15, 2010

MS SQL 2008 R2 useful features

Yes ,SQL server 2008 has a new version again. Its R2 folks. Im going to give you some basic and useful ways to use the new features
  • Policy based management (PBM) --control database,table, trigger and object names
  • Resource governer --take control of your memory and processor again
  • Back up compression ---Dont need more SAN LUNS
  • data file encrytion --- someone stole your mdf files..no worries
  • filestream--- replace BLOB with this
  • New report builder 3.0 --more charts and datasets added
  • New database mirroring recovery options
  • totally rebuild database replication engine
  • New sharepoint integration..