Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Ahmad Farid
Starting Member
7 Posts |
Posted - 2008-07-30 : 09:36:59
|
| [code]CREATE FUNCTION dbo.BytesToString( @code Image )RETURNS NVARCHAR(100)BEGIN DECLARE @word NVARCHAR(100) DECLARE @letter NVARCHAR(1) DECLARE @index INT DECLARE @pas IMAGE SELECT @pas = @code WHILE @index<DATALENGTH(@code) BEGIN SELECT @word = @word + CHAR(c) FROM @pas WHERE INDEX(c)=@index SELECT @index = @index + 1 END RETURN @wordEND[/code]Msg 137, Level 15, State 2, Procedure BytesToString, Line 20Must declare the variable '@pas'.I get that error that I have to declare the variable @pas which is alreay declared. Am I correct at first? Do you have any better suggestion to do that? Thank you :) |
|
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2008-07-30 : 11:21:22
|
| Because you can't select from an Image. You can't select from any datatype. Only from Tables and Views.e4 d5 xd5 Nf6 |
 |
|
|
Ahmad Farid
Starting Member
7 Posts |
Posted - 2008-07-30 : 11:24:28
|
| Thanks blindman. So is there any alternative solution for that? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-30 : 11:29:44
|
quote: Originally posted by Ahmad Farid Thanks blindman. So is there any alternative solution for that?
what are you trying to do inside loop? |
 |
|
|
Ahmad Farid
Starting Member
7 Posts |
Posted - 2008-07-30 : 11:33:43
|
| I want to send an array of integers or bytes from .net C# code to a stored procedure. I want to change this array into the corresoponding string of characters through SQL. Thanks for your help :) |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-07-30 : 11:50:37
|
| select convert(ntext, @code) ??_______________________________________________Causing trouble since 1980Blog: http://weblogs.sqlteam.com/mladenpSpeed up SSMS development: www.ssmstoolspack.com <- version 1.0 out! |
 |
|
|
|
|
|