MSSQL

How to convert a float to string without using scientific notation on SQL Server?

The trivial soluation is using CONVERT:
select convert(varchar(100), cast(float_field as decimal(20, 2))) from ...

But there is another, a lot shorter method: using STR
select str(float_field, 20, 2) from ...

How to convert table (or column) names to uppercase in an SQL Server database

The following routine will do the trick ...

Reverse engineering usage of Siebel base tables

All Siebel base tables have a couple of mandatory columns, including a LAST_UPD date column that contains the date of last modification for a given record. Using this you can easily write a procedure to look for tables/records that have changed since a specific date (or in the last "n" minutes). Thus you can find out for every operation available in Siebel Tools the tables it involves. Eg. you can edit the web layout of an applet, save the changes and then query the list of tables that contain records updated in the last 1-2 minutes to see where are the layout settings stored. You can apply the same method for any operations via the user interface (like adding/modifying a new contact, an employee, etc.).

Find references to a record of a Siebel table in all of its foreign key tables

The Transact SQL code below comes handy when you're digging into Siebel's tables. It will find all references to a specific record in a specific table (identified by the table's name in the @Table parameter and the rowid of the record in the @Rowid parameter) by going through all the foreign keys that are pointing to the specified table and executing a query to get the count of referring records. Since this is a Transact SQL code snippet, it suggests you're running Siebel CRM on a Microsoft SQL Server (which is not the typical case ... but occurs anyway as it did with one of the clients of my company). Smiling

Scripting data in MSSQL

It's a fairly basic requirement to export data from a database table in the form of SQL "INSERT" instructions. However in case of Microsoft SQL Server it's not that simple. There's a utility called "Microsoft SQL Server Database Publishing Wizard", which comes packaged with SQL Server 2008, but has to be downloaded (and installed) separately for SQL Server 2005. Unfortunately it's not very sophisticated and here come the various 3rd party developers into the picture.

Syndicate content