当前位置:网站首页>sql 引用变量时第一位的0被去除掉如何处理
sql 引用变量时第一位的0被去除掉如何处理
2022-07-30 06:35:00 【CSDN问答】
sql server 2008 r2
代码:
declare @userid varchar(100)
declare @sql varchar(1000)
set @userid = 01541815191726247754
set @sql = ' select * from test where userid = '''+@userid+ ''''
select @sql
结果:
select * from test where userid = '1541815191726247754'
引用变量@userid 时第一位0被去除掉了,导致查不到数据,这个要怎么处理?
看了网上都是以知道位数为前提的处理方法,但是userid没有固定的位数,无法那样处理
边栏推荐
猜你喜欢
随机推荐
Electron之初出茅庐——搭建环境并运行第一个程序
01 多线程与高并发 - 基础概念
如何实时计算日累计逐单资金流
How does Redis prevent oversold and inventory deduction operations?
Electron使用romote报错 : Uncaught TypeError: Cannot read property ‘BrowserWindow‘ of undefined
【day5】数组
适合程序员的输入法
golang: Gorm配置Mysql多数据源
分布式锁开发
Interview with Ant: How do these technology pioneers do the bottom-level development well?| Excellent technical team interview
MySQL basics [naming convention]
MySQL master-slave replication configuration construction, one step in place
一段神奇的没有主方法的代码
Keil compile size and storage instructions
什么是微服务?
02 多线程与高并发 - synchronized 解析
IDEA search plug-in has no results and the solution has been spinning in circles
What are the access modifiers, declaration modifiers, and keywords in C#?Literacy articles
IDEA搜索插件无结果一直转圈圈的解决办法
Mybitatis related configuration files








