Category Archives: Sybase

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

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

The Entertaining Sybase. What do LTRIM and RTRIM return?

I have been working with Sybase ASE for a year. And there is a lot of fun with this database and which would like to collect here. What do  LTRIM and RTRIM return in the query? SELECT [Space R] = RTRIM(‘ … Continue reading

Posted in Entertaining Sybase, Sybase | Leave a comment

T-SQL one line comments

I have aT-SQL script (for Sybase) which contains two slashes one line comments. The script works pretty well at Aqua Data Studio 4.7.2. But when I am running it calling Sybase.AdoNet2.AseClient.dll API it fails with message ‘ Incorrect syntax near “/” … Continue reading

Posted in Sybase, T-SQL | Leave a comment