Category Archives: T-SQL

Text data type can not be ordered or unioned

It was astonished for me that databases like MS SQL and Sybase do not support ordering and union by columns of the TEXT type (and some other data types, in short big data blobs). It seems the reason is logical. … Continue reading

Posted in Microsoft SQL Server, Sybase | Leave a comment

Get Columns of Particular Type in Database (Sybase)

The procedure below allows you to get a column list of a particular type in a database currently used: CREATE PROCEDURE dbo.GetColumnOfType @type longsysname AS SELECT c.name, t.name, * FROM syscolumns c LEFT OUTER JOIN systypes t ON t.type = … Continue reading

Posted in Sybase, T-SQL | Leave a comment

Drop a sql schema with its referencing objects

As you may know if you want to drop a schema in sql you have to drop all its objects by hands first (tables, views, procedures, functions). Of course this restriction is essential to avoid loosing of data. But if … Continue reading

Posted in Microsoft SQL Server, T-SQL | Leave a comment

Database Continuous Integration

Database Continuous Integration (further DCI) is a useful way to manage a database schema during an application life-cycle. There are several community libraries to implement the DCI but all of them (those I have seen) integrate into a build process. … Continue reading

Posted in .NET, ASP .NET MVC, T-SQL | Leave a comment

Get Random Records from a Table (Sybase)

To get random records from a table in Sybase, you can use NEWID() function in ORDER BY clause. The function returns a unique and random global identifier (GUID). Example: SELECT TOP 100 * FROM dbo.Data ORDER BY NEWID()

Posted in Sybase, T-SQL | 3 Comments