tags:

views:

39

answers:

1

This is not a calculation or a function, it is simply a command I have to add often which is difficult to remember.

I am often running queries on data across two databases (one old, one new) so I have to add "collate SQL_Latin1_General_CP1_CI_AS" wherever values of one are being compared with values of the other.

For example...

...where db1.transactions.accountnumber = db2.clients.accountnumber collate SQL_Latin1_General_CP1_CI_AS

Is there a way to create something like a 'reserved word' for this, so that I could type something like the following...

where db1.transactions.accountnumber = db2.clients.accountnumber coll

where 'coll' is the replacement for 'collate SQL_Latin1_General_CP1_CI_AS'

+3  A: 

SSMS tools pack (free) has snippets which may do what you want.

We use SQL prompt too which has the same.

FYI: Have you considered COLLATE Database_Default which coerces collation to the current DB?

gbn
I downloaded the tool pack, then started downloading SP2 which it needs... Then I saw your edit. database_default does work. much easier to remember. Thanks :). The tool pack looks like it might be useful for other things so I'll carry on with the sp2 upgrade.
MrVimes