Friday, May 22, 2015

SSRS Dynamic Grouping

At some point, you will want your users to be able to choose what to group their reports by. This article written by Chris Hays shows perfectly how to create a dynamic grouping:

http://blogs.msdn.com/b/chrishays/archive/2004/07/15/dynamicgrouping.aspx?Redirected=true

This is definately worth checking out.

FoxPro shorthand syntax for searching a string

The dollar sign in between two strings is a search for symbol like the following:
cSearchFor $ cSearchIn

How to perform a database backup with tsql

Most people (that have used sql server) know how to backup and restore a database as a new name from Sql Server Management Studio, but it‘s not always quite so apparent how to backup and restore a database as a different name in tsql. Here is just a reminder as to how to backup and restore into a different name. This can also be used for seperating “Development” and “Test”.

— Perform database backups

print ‘Backup Development database’

BACKUP DATABASE [Development]

TO DISK = N’G:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Backup\Development\Development_full_backup.bak’

WITH NOFORMAT, INIT, NAME = N’Development-Full Database Backup’, SKIP, NOREWIND, NOUNLOAD, STATS = 10

GO

print ‘Backup Test database’

BACKUP DATABASE [Test]

TO DISK = N’G:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Backup\Test\Test_full_backup.bak’

WITH NOFORMAT, INIT, NAME = N’Test-Full Database Backup’, SKIP, NOREWIND, NOUNLOAD, STATS = 10


— Perform database restores from SeconddaryDev

use master

go

Alter Database [Test] set Auto_Update_Statistics_Async OFF

go

Alter Database [Test] set Single_User With Rollback Immediate

go

print ‘Restore Development to Test’

RESTORE DATABASE [Test]

FROM DISK = N’G:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Backup\Development\Development_full_backup.bak’

WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10

GO

Alter Database [Test] set Multi_User



go