sql 查询条件字段为text或ntext 的解决方案
sql 查询条件字段为text或ntext得解决方案以及varchar(max)、nvarchar(max)
1、在MS SQL2005及以上的版本中,加入大值数据类型(varchar(max)、nvarchar(max)、varbinary(max) )。大值数据类型最多可以存储2^30-1个字节的数据。
这几个数据类型在行为上和较小的数据类型 varchar、nvarchar 和 varbinary 相同。
微软的说法是用这个数据类型来代替之前的text、ntext 和 image 数据类型,它们之间的对应关系为:
varchar(max)-------text;
nvarchar(max)-----ntext;
varbinary(max)----image.
有了大值数据类型之后,在对大值数据操作的时候要比以前灵活的多了。比如:之前text是不能用‘like’的,有了varchar(max)之后就没有这些问题了,因为varchar(max)在行为上和varchar(n)上相同,所以,可以用在varcahr的都可以用在varchar(max)上。
所以请使用 varchar(max)、nvarchar(max) 和 varbinary(max) 数据类型,而不要使用 text、ntext 和 image 数据类型。
2、如果需要处理已经存在的text类型 的查询 则需要进行字段转换下 where cast(text as varchar)
3、实例如下,其中i_item为ntext
select * from IP_Investigate
where I_InvestigateID in (select IS_ID from IP_InvestigateStatus
where IS_Name like 'tomcat%') and cast(i_item as varchar)='1'
update IP_Investigate
set i_order=5
where I_InvestigateID in (select IS_ID from IP_InvestigateStatus
where IS_Name like 'tomcat%') and cast(i_item as varchar)='5'
相关文档:
ALTER procedure [dbo].[sp_lock_check]
@spid1 int = NULL,
@spid2 int = NULL
as
set nocount on
if @spid1 is not NULL
begin
select ......
此为转贴,但是从连个帖子中收集而来
下面来一起看看论坛里的一个oracle方面的问题:
====================Question
=========================
jmbdat dayt y &n ......
导入的详细流程
1、新建一个数据库
2、在新的数据库上点右键-》“所有任务”-》“导入数据库”,点下一步
3、什么都不要改,在数据库中选择那个旧的数据库,点下一步
4、在这个界面的数据库中选择你新建的数据库,点下一步
5、选择“在SQL SERVER数据库之间复制对象和数据”,点下一步
......
一个简单的小实例就明白~!
user表
在这张表中建立触发器
Create trigger tiggername
on user
for delete
as
begin ......
What is SQL*Plus and where does it come from?
SQL*Plus is a command line SQL and PL/SQL language interface and reporting tool that ships with the Oracle Database Client and Server software. It can be used interactively or driven from scripts. SQL*Plus is frequently used by DBAs and Developers ......