1

I have to know the data type of some columns in my table in Sybase ASE. Here is my query

select name from systypes
where type in (39,
47,
39,
39,
106
)

this returns

char       
varchar    
sysname    
nchar      
nvarchar       
decimaln       
longsysname    

I was hoping it would return

varchar
char
varchar
varchar
decimaln

why are the results not as expected ? How can i get the proper column types ? I intend to use this information later to create a dynamic query that creates another table.

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786
AbtPst
  • 7,778
  • 17
  • 91
  • 172
  • May I ask why you tag MySQL when it's a Sybase specific question? – jarlh Dec 19 '14 at 14:22
  • What makes you thing the actual result is wrong? Hoping rarely fixes coding errors. – idstam Dec 19 '14 at 14:23
  • 1
    Look at the systypes table. `type = 39` gives 4 results : varchar, sysname, nvarchar, longsysname. SO the result is as your request expects them to be. – BMN Dec 19 '14 at 14:24
  • but when i created the table, i specified the column type as varchar – AbtPst Dec 19 '14 at 15:41

1 Answers1

1

You need to join systypes to syscolumns on both the type and usertype columns.

Pang
  • 9,564
  • 146
  • 81
  • 122
RobV
  • 2,263
  • 1
  • 11
  • 7