如何将图像类型转换为varchar sybase

时间:2013-04-03 09:47:53

标签: sql tsql sybase sybase-ase

经过一段时间后我登陆sybase(ASE 15 ..具体)世界,随着时间的推移,我有点害怕 从sql server我知道缺少的功能和功能让我觉得我早在90'

到了这一点 我必须准备一次性报告 有一些文本存储为图像列(不知道为什么有人这样做) 所以我做的是

select CAST(CAST(REQUEST AS VARBINARY(16384)) AS VARCHAR(16384))  as RequestBody
from table

问题是因为某些请求超过16384 并且不知道如何获取数据

更糟糕的是我不知道在哪里查找信息,因为sybase文档在最好的情况下是稀疏的,并且与MS世界相比,它不存在

2 个答案:

答案 0 :(得分:1)

根据docs你需要使用CONVERT函数:

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_height="?actionBarSize"
    android:layout_width="match_parent"
    android:background="@color/colorPrimary">

    <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    android:gravity="center_horizontal">
    <ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" 
    android:src="@drawable/ic_launcher_background"/>
    <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="My Title"/>
    </LinearLayout>

</android.support.v7.widget.Toolbar>

答案 1 :(得分:-1)

尝试使用varbinary(max)和varchar(max),而不是使用varbinary(16384)和varchar(16384)。在这种情况下,最大数据长度为2 GB。

请参阅: http://msdn.microsoft.com/en-us/library/ms176089.aspxhttp://msdn.microsoft.com/en-us/library/ms188362.aspx

表格中REQUEST列的长度是多少?