thebeebs | November 2008
thebeebs
Learn the art of website security
 
 

So you’ve hard coded VAT at 17.5% in SQL?

by thebeebs 24. November 2008 09:38

 

 

header_vat_return

Yikes!… Alistair Campbell has just announced VAT has been reduced from 17.5% to 15% in the UK. In SQL it’s often the case that values like VAT are often hard coded. To help you reduce the time it takes to search your database I wrote the SQL code below which should help you find any stored procedures that contain hard coding and any column names that contain VAT and may need checking.

I hope they are of some use to someone:

 

DECLARE @search NVARCHAR(10)DECLARE @Command NVARCHAR(MAX)
SET @search= '%0.175%'
SET @Command = 'SELECT [TEXT], [NAME], ''?'' as DatabaseName FROM ?.DBO.SYSCOMMENTS C JOIN ?.DBO.SYSOBJECTS O ON C.ID = O.ID WHERE TEXT like ''' + @search + ''''
EXEC sp_MsForEachDb @command1= @CommandSET @search= '%1.175%'
SET @Command = 'SELECT [TEXT], [NAME], ''?'' as DatabaseName FROM ?.DBO.SYSCOMMENTS C JOIN ?.DBO.SYSOBJECTS O ON C.ID = O.ID WHERE TEXT like ''' + @search + ''''
EXEC sp_MsForEachDb @command1= @Command
SET @search= '%VAT%'
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME LIKE @search

 

Tags:

Thou shalt not ignore my source control commandments

by thebeebs 17. November 2008 14:34

Scott Mitchell recently wrote his 8 commandments of source control... In general they are very different to mine which are:

  • Thou shalt use either SVN or Team Foundation Server - Because one's free and the other is more perfect than unicorn tears.
  • Thou shalt not use SourceSafe - Because two people need to work on the same file at the same time.
  • Thou shalt merge to the trunk regularly - Because no one want's to spend 1/2 their life merging.
  • Thou Shalt Never Branch - If you need to branch you're biting off too much in one go, reduce the size of your iteration.
  • Thou shalt never check in without updating and merging with the trunk locally - Because I'm a pacifist and hate conflict
  • Thou shalt never check in without FxCopping - Because we have rules and you need to stick to them.
  • Thou shalt Never check in without StyleCoping - Because we are anally retentive and require you to be too.
  • Thou shalt never Check-in without passing all unit tests - Because you'll break the build; and our integrity
  • Thou shalt not enter blank comments - Cuz people which do, sniff glue.

And in life:

  • Thou shalt not shake it like a Polaroid picture.
  • Thou shalt not worship pop idols
  • Thou shalt not question Stephen Fry.
  • Thou shalt not judge a book by its cover.
  • Thou shalt not judge Lethal Weapon by Danny Glover.
  • Thou shalt not use poetry, art or music to get into girls' pants. Use it to get into their heads.

Thanks Scroobius Pip for the above

Tags: