6 个解决方案
#1
你不可能用SQL语句转换啊
#2
TRY:
declare @str varchar(8000)
select @str='0x'+'0605041582000064f00000480e010000000000000000007c079fff3c1f1e07e07e07bfffbc3e1e07e07f07bfffbc7c1e0ff07f87bc07bcf81e0ff07fc7bc07bdf01e1e787be7bc07bfe01e1e7879f7bc07bdf01e3c3c78ffbc07bcf81e3ffc787fbc07bc7c1e7ffe783fbfffbc3e1e7ffe781fbfffbc1f1ef81f780f9fff3c0f9ef00f000000000000000000'
exec ('select '+@str) ---返回的结果是binary的。:)
declare @str varchar(8000)
select @str='0x'+'0605041582000064f00000480e010000000000000000007c079fff3c1f1e07e07e07bfffbc3e1e07e07f07bfffbc7c1e0ff07f87bc07bcf81e0ff07fc7bc07bdf01e1e787be7bc07bfe01e1e7879f7bc07bdf01e3c3c78ffbc07bcf81e3ffc787fbc07bc7c1e7ffe783fbfffbc3e1e7ffe781fbfffbc1f1ef81f780f9fff3c0f9ef00f000000000000000000'
exec ('select '+@str) ---返回的结果是binary的。:)
#3
上一楼的,我怎么才能把这格式的数据存到binary的变量里,或把它插到表的一个binary字段里?
#4
TRY:
exec ('insert into table (字段名) select '+@str)
exec ('insert into table (字段名) select '+@str)
#5
怎么赋给变量啊?
#6
参考:
declare @tcnt int
declare @paras varchar(100)
DECLARE @SQLString NVARCHAR(500)
set @paras ='1,3,5'
set @sqlstring=N'select @cnt=count(*) from sysobjects where id in ('+@paras+')'
set @tcnt=0
execute sp_executesql
@sqlstring,
N'@cnt int output',
@cnt=@tcnt output
select @tcnt
select * from sysobjects
declare @tcnt int
declare @paras varchar(100)
DECLARE @SQLString NVARCHAR(500)
set @paras ='1,3,5'
set @sqlstring=N'select @cnt=count(*) from sysobjects where id in ('+@paras+')'
set @tcnt=0
execute sp_executesql
@sqlstring,
N'@cnt int output',
@cnt=@tcnt output
select @tcnt
select * from sysobjects
#1
你不可能用SQL语句转换啊
#2
TRY:
declare @str varchar(8000)
select @str='0x'+'0605041582000064f00000480e010000000000000000007c079fff3c1f1e07e07e07bfffbc3e1e07e07f07bfffbc7c1e0ff07f87bc07bcf81e0ff07fc7bc07bdf01e1e787be7bc07bfe01e1e7879f7bc07bdf01e3c3c78ffbc07bcf81e3ffc787fbc07bc7c1e7ffe783fbfffbc3e1e7ffe781fbfffbc1f1ef81f780f9fff3c0f9ef00f000000000000000000'
exec ('select '+@str) ---返回的结果是binary的。:)
declare @str varchar(8000)
select @str='0x'+'0605041582000064f00000480e010000000000000000007c079fff3c1f1e07e07e07bfffbc3e1e07e07f07bfffbc7c1e0ff07f87bc07bcf81e0ff07fc7bc07bdf01e1e787be7bc07bfe01e1e7879f7bc07bdf01e3c3c78ffbc07bcf81e3ffc787fbc07bc7c1e7ffe783fbfffbc3e1e7ffe781fbfffbc1f1ef81f780f9fff3c0f9ef00f000000000000000000'
exec ('select '+@str) ---返回的结果是binary的。:)
#3
上一楼的,我怎么才能把这格式的数据存到binary的变量里,或把它插到表的一个binary字段里?
#4
TRY:
exec ('insert into table (字段名) select '+@str)
exec ('insert into table (字段名) select '+@str)
#5
怎么赋给变量啊?
#6
参考:
declare @tcnt int
declare @paras varchar(100)
DECLARE @SQLString NVARCHAR(500)
set @paras ='1,3,5'
set @sqlstring=N'select @cnt=count(*) from sysobjects where id in ('+@paras+')'
set @tcnt=0
execute sp_executesql
@sqlstring,
N'@cnt int output',
@cnt=@tcnt output
select @tcnt
select * from sysobjects
declare @tcnt int
declare @paras varchar(100)
DECLARE @SQLString NVARCHAR(500)
set @paras ='1,3,5'
set @sqlstring=N'select @cnt=count(*) from sysobjects where id in ('+@paras+')'
set @tcnt=0
execute sp_executesql
@sqlstring,
N'@cnt int output',
@cnt=@tcnt output
select @tcnt
select * from sysobjects