同一类型

sincer1030 2009-05-30 08:41:00
请教各位: 怎么查找同一字段只为VARCHAR型的数据.INT,BIT其它类型不显示.(例:select * from View_rec_judge
where rec_sid is varchar)
...全文
65 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
sincer1030 2009-05-30
  • 打赏
  • 举报
回复
楼上的各位方法都不错.谢谢各位的帮忙解答才让我的问题得以解决.衷心感谢
ai_li7758521 2009-05-30
  • 打赏
  • 举报
回复
学习
sincer1030 2009-05-30
  • 打赏
  • 举报
回复
PATINDEX 函数只能对 char、nchar、varchar、nvarchar、text 和 ntext 数据类型进行操作。 [Quote=引用 1 楼 csdyyr 的回复:]
SQL codeselect *
from View_rec_judge
where patindex('%[0-9]%', rec_sid)=0
[/Quote]
kingdomxpxp 2009-05-30
  • 打赏
  • 举报
回复
try:

select * into #tb2 from (select a.name from dbo.syscolumns a,dbo.sysobjects b
where a.xtype=167 and a.id=b.id and b.name='表名') s

declare @sql varchar(1000)
select @sql=isnull(@sql+',','')+name from #tb2
select @sql='select '+@sql+' 表名'
exec (@sql)
JonasFeng 2009-05-30
  • 打赏
  • 举报
回复
楼上的方法不错。
jiujiang88 2009-05-30
  • 打赏
  • 举报
回复
没碰到过,2楼的只能判断该字段中不为数字型数据。
csdyyr 2009-05-30
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 csdyyr 的回复:]
SQL codeselect*fromView_rec_judgewherepatindex('%[0-9]%', rec_sid)=0
[/Quote]

select *
from View_rec_judge
where isnumeric(rec_sid)=0
csdyyr 2009-05-30
  • 打赏
  • 举报
回复
select *
from View_rec_judge
where patindex('%[0-9]%', rec_sid)=0

27,579

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 应用实例
社区管理员
  • 应用实例社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧