Mats codemix

Mats codemix

A little c#, a litte .NET and throw in some c++ and you get a nice Spaghetti

Mats codemix RSS Feed
 
 
 
 

Posts tagged sqlcode

SQL-formatter (updated)

Working a lot with SQL at the moment i found a handy tool for formatting SQL-code.
SqlInform automatic SQL code formatter (http://www.sqlinform.com/)

There is an online version but also a free although time-limited JAVA-program to download. The online version handles just 100 lines of code mind you.
Another online formatter without the 100-line limit.  http://www.dpriver.com/pp/sqlformat.htm
Some that i [...]

Making groups unique - fixing a duplicate key problem in SQL

I ran into a problem where updating a key column caused duplicate key errors.  The table in question had several columns that formed the Primary Key.  One of those columns was userd for a  serial number making groups of keys unique.
Example

Group

GroupSerial

Apple

1

Apple

1

Pear

1

Pear

1

Here we see that each row is not unique.
So how can we fix this?
First [...]

SQL - Show tables containing a column

When digging through database tables i use this little select-sctatement to find out which tables that contain a scertain column name.
1 — Show tables containing a column
2 select sysobj.name + ‘.’ + syscol.name
3 , ’sp_help ‘ + sysobj.name as sptext
4 , ’select * from ‘ + sysobj.name as selall
5 , [...]