Monday, March 26, 2012
Image to Varchar
I have a small doubt.
How to convert an Imaage of about 110 character length to varchar.
The image is nothing but the text data stored in that format.
While using "convert" function for smaller data,Image to Varchar and
Varchar to Image conversion is successful.
But, here the image is too lengthy.
Kindly, anyone suggest a way.
Thanks,
Dutt.
Dutt
declare @.b binary(4), @.str varchar(255)
select @.b = 3455643
exec master..xp_varbintohexstr @.b, @.str out
print @.str
select cast(cast(cast(0x41 as nvarchar) as varbinary)as varchar)
"Dutt" <Mr.Dutt@.gmail.com> wrote in message
news:1167893950.543251.130570@.31g2000cwt.googlegro ups.com...
> Hi All,
> I have a small doubt.
> How to convert an Imaage of about 110 character length to varchar.
> The image is nothing but the text data stored in that format.
> While using "convert" function for smaller data,Image to Varchar and
> Varchar to Image conversion is successful.
> But, here the image is too lengthy.
> Kindly, anyone suggest a way.
> Thanks,
> Dutt.
>
|||> But, here the image is too lengthy.
What do you mean by 'too lengthy'?
Try:
SELECT CAST(SUBSTRING(MyImageColumn, 1, 110) AS varchar(110))
FROM dbo.MyTable
Hope this helps.
Dan Guzman
SQL Server MVP
"Dutt" <Mr.Dutt@.gmail.com> wrote in message
news:1167893950.543251.130570@.31g2000cwt.googlegro ups.com...
> Hi All,
> I have a small doubt.
> How to convert an Imaage of about 110 character length to varchar.
> The image is nothing but the text data stored in that format.
> While using "convert" function for smaller data,Image to Varchar and
> Varchar to Image conversion is successful.
> But, here the image is too lengthy.
> Kindly, anyone suggest a way.
> Thanks,
> Dutt.
>
|||Hi Dan,
I'm getting some output with that.Even,I have tried it earlier.
But the problem is that the image is being converted into ANSII code,I
suppose.
I'm not getting the actual text.
Thanks
Dutt.
Dan Guzman wrote:[vbcol=seagreen]
> What do you mean by 'too lengthy'?
> Try:
> SELECT CAST(SUBSTRING(MyImageColumn, 1, 110) AS varchar(110))
> FROM dbo.MyTable
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Dutt" <Mr.Dutt@.gmail.com> wrote in message
> news:1167893950.543251.130570@.31g2000cwt.googlegro ups.com...
|||> I'm getting some output with that.Even,I have tried it earlier.
> But the problem is that the image is being converted into ANSII code,I
> suppose.
> I'm not getting the actual text.
How is the text encoded? I would expect that the data would be converted
according to your database default collation. Can you post a raw data
sample (e.g. 0x68656c6c6f) along with your expected results (e.g. 'hello')?
Hope this helps.
Dan Guzman
SQL Server MVP
"Dutt" <Mr.Dutt@.gmail.com> wrote in message
news:1167970260.405637.12700@.11g2000cwr.googlegrou ps.com...
> Hi Dan,
> I'm getting some output with that.Even,I have tried it earlier.
> But the problem is that the image is being converted into ANSII code,I
> suppose.
> I'm not getting the actual text.
> Thanks
> Dutt.
> Dan Guzman wrote:
>
Image to Varchar
I have a small doubt.
How to convert an Imaage of about 110 character length to varchar.
The image is nothing but the text data stored in that format.
While using "convert" function for smaller data,Image to Varchar and
Varchar to Image conversion is successful.
But, here the image is too lengthy.
Kindly, anyone suggest a way.
Thanks,
Dutt.Dutt
declare @.b binary(4), @.str varchar(255)
select @.b = 3455643
exec master..xp_varbintohexstr @.b, @.str out
print @.str
select cast(cast(cast(0x41 as nvarchar) as varbinary)as varchar)
"Dutt" <Mr.Dutt@.gmail.com> wrote in message
news:1167893950.543251.130570@.31g2000cwt.googlegroups.com...
> Hi All,
> I have a small doubt.
> How to convert an Imaage of about 110 character length to varchar.
> The image is nothing but the text data stored in that format.
> While using "convert" function for smaller data,Image to Varchar and
> Varchar to Image conversion is successful.
> But, here the image is too lengthy.
> Kindly, anyone suggest a way.
> Thanks,
> Dutt.
>|||> But, here the image is too lengthy.
What do you mean by 'too lengthy'?
Try:
SELECT CAST(SUBSTRING(MyImageColumn, 1, 110) AS varchar(110))
FROM dbo.MyTable
Hope this helps.
Dan Guzman
SQL Server MVP
"Dutt" <Mr.Dutt@.gmail.com> wrote in message
news:1167893950.543251.130570@.31g2000cwt.googlegroups.com...
> Hi All,
> I have a small doubt.
> How to convert an Imaage of about 110 character length to varchar.
> The image is nothing but the text data stored in that format.
> While using "convert" function for smaller data,Image to Varchar and
> Varchar to Image conversion is successful.
> But, here the image is too lengthy.
> Kindly, anyone suggest a way.
> Thanks,
> Dutt.
>|||Hi Dan,
I'm getting some output with that.Even,I have tried it earlier.
But the problem is that the image is being converted into ANSII code,I
suppose.
I'm not getting the actual text.
Thanks
Dutt.
Dan Guzman wrote:[vbcol=seagreen]
> What do you mean by 'too lengthy'?
> Try:
> SELECT CAST(SUBSTRING(MyImageColumn, 1, 110) AS varchar(110))
> FROM dbo.MyTable
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Dutt" <Mr.Dutt@.gmail.com> wrote in message
> news:1167893950.543251.130570@.31g2000cwt.googlegroups.com...|||> I'm getting some output with that.Even,I have tried it earlier.
> But the problem is that the image is being converted into ANSII code,I
> suppose.
> I'm not getting the actual text.
How is the text encoded? I would expect that the data would be converted
according to your database default collation. Can you post a raw data
sample (e.g. 0x68656c6c6f) along with your expected results (e.g. 'hello')?
Hope this helps.
Dan Guzman
SQL Server MVP
"Dutt" <Mr.Dutt@.gmail.com> wrote in message
news:1167970260.405637.12700@.11g2000cwr.googlegroups.com...
> Hi Dan,
> I'm getting some output with that.Even,I have tried it earlier.
> But the problem is that the image is being converted into ANSII code,I
> suppose.
> I'm not getting the actual text.
> Thanks
> Dutt.
> Dan Guzman wrote:
>sql
Image to Varchar
I have a small doubt.
How to convert an Imaage of about 110 character length to varchar.
The image is nothing but the text data stored in that format.
While using "convert" function for smaller data,Image to Varchar and
Varchar to Image conversion is successful.
But, here the image is too lengthy.
Kindly, anyone suggest a way.
Thanks,
Dutt.Dutt
declare @.b binary(4), @.str varchar(255)
select @.b = 3455643
exec master..xp_varbintohexstr @.b, @.str out
print @.str
select cast(cast(cast(0x41 as nvarchar) as varbinary)as varchar)
"Dutt" <Mr.Dutt@.gmail.com> wrote in message
news:1167893950.543251.130570@.31g2000cwt.googlegroups.com...
> Hi All,
> I have a small doubt.
> How to convert an Imaage of about 110 character length to varchar.
> The image is nothing but the text data stored in that format.
> While using "convert" function for smaller data,Image to Varchar and
> Varchar to Image conversion is successful.
> But, here the image is too lengthy.
> Kindly, anyone suggest a way.
> Thanks,
> Dutt.
>|||> But, here the image is too lengthy.
What do you mean by 'too lengthy'?
Try:
SELECT CAST(SUBSTRING(MyImageColumn, 1, 110) AS varchar(110))
FROM dbo.MyTable
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Dutt" <Mr.Dutt@.gmail.com> wrote in message
news:1167893950.543251.130570@.31g2000cwt.googlegroups.com...
> Hi All,
> I have a small doubt.
> How to convert an Imaage of about 110 character length to varchar.
> The image is nothing but the text data stored in that format.
> While using "convert" function for smaller data,Image to Varchar and
> Varchar to Image conversion is successful.
> But, here the image is too lengthy.
> Kindly, anyone suggest a way.
> Thanks,
> Dutt.
>|||Hi Dan,
I'm getting some output with that.Even,I have tried it earlier.
But the problem is that the image is being converted into ANSII code,I
suppose.
I'm not getting the actual text.
Thanks
Dutt.
Dan Guzman wrote:
> > But, here the image is too lengthy.
> What do you mean by 'too lengthy'?
> Try:
> SELECT CAST(SUBSTRING(MyImageColumn, 1, 110) AS varchar(110))
> FROM dbo.MyTable
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Dutt" <Mr.Dutt@.gmail.com> wrote in message
> news:1167893950.543251.130570@.31g2000cwt.googlegroups.com...
> > Hi All,
> > I have a small doubt.
> > How to convert an Imaage of about 110 character length to varchar.
> > The image is nothing but the text data stored in that format.
> > While using "convert" function for smaller data,Image to Varchar and
> > Varchar to Image conversion is successful.
> > But, here the image is too lengthy.
> > Kindly, anyone suggest a way.
> > Thanks,
> > Dutt.
> >|||> I'm getting some output with that.Even,I have tried it earlier.
> But the problem is that the image is being converted into ANSII code,I
> suppose.
> I'm not getting the actual text.
How is the text encoded? I would expect that the data would be converted
according to your database default collation. Can you post a raw data
sample (e.g. 0x68656c6c6f) along with your expected results (e.g. 'hello')?
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Dutt" <Mr.Dutt@.gmail.com> wrote in message
news:1167970260.405637.12700@.11g2000cwr.googlegroups.com...
> Hi Dan,
> I'm getting some output with that.Even,I have tried it earlier.
> But the problem is that the image is being converted into ANSII code,I
> suppose.
> I'm not getting the actual text.
> Thanks
> Dutt.
> Dan Guzman wrote:
>> > But, here the image is too lengthy.
>> What do you mean by 'too lengthy'?
>> Try:
>> SELECT CAST(SUBSTRING(MyImageColumn, 1, 110) AS varchar(110))
>> FROM dbo.MyTable
>> --
>> Hope this helps.
>> Dan Guzman
>> SQL Server MVP
>> "Dutt" <Mr.Dutt@.gmail.com> wrote in message
>> news:1167893950.543251.130570@.31g2000cwt.googlegroups.com...
>> > Hi All,
>> > I have a small doubt.
>> > How to convert an Imaage of about 110 character length to varchar.
>> > The image is nothing but the text data stored in that format.
>> > While using "convert" function for smaller data,Image to Varchar and
>> > Varchar to Image conversion is successful.
>> > But, here the image is too lengthy.
>> > Kindly, anyone suggest a way.
>> > Thanks,
>> > Dutt.
>> >
>
Friday, March 23, 2012
image located on web, url for image stored in database
Hi,
I have a website and i am uploading the gif image to the database. i have used varchar(500) as the datatype and i am saving the file in the webserver so the path to it c:\intepub\....a.gif
my upload table has the folliwing feilds
UploadId Int Identity, Description, FileName, DiskPath varchar(500), weblocation varchar(500). I have a main sproc for the report where i am doing a inner join with other table to get the path of the gif..
So my question is how can i get a picture to show up on the report. .
What kinda datatype the gif file should be stored in the database? If it is stored as a varchar how can i access it and what is best way to reference that particular.
any help will appreciated....
Regards
Karen
This should help:
http://technet.microsoft.com/en-us/library/ms156482.aspx
But I must ask, why do you want to store the image in your database? Why not just host it on a website?
|||Anyone know a way to do this? I want to create a report that will use a table from sql that has a url which points to an image. I want this image to show up in a table in my report. The end goal is to have a searchable report with parameters that supplies immages (from the web) based on search criteria.|||
Greg,
I have stored the image as a gif file on my webserver, but i couldnt access it, but now i gave the url to it and then specified it as a external image and everything works fine.. i am storing the reference to the image.... in the database.
Thanks a lot.
Regards
Karen
|||If I understand this post, I am having simmilar difficulties. I want to have a table in sql that has verious links to images locaed on the web. I want to display these images in my report. I'm quite confused and pretty new to this so if you can treat me like I know nothing at all and show me step by step what you did I'd really appreciat it.|||
I have merged the two threads as they are highly related.
|||Mflancour,
I am uploading the image using a file upload control in the database. and i am storing the like a URL http://Ipaddress/Nameoftheapplication/anyfolders/andsubfoldersintheapplication/Filename.gif. This field is set up in a my database as varchar(500) so i will be storing the above information in that field.
Then, in reporting service .... get the field that u want to access in the particular dataset
From the tool box select image and follow the wizard and select Database and then select the dataset and the field
then select the image and in the properties change the source to external and preview it.
and it should work
hope this helps.
Karen
|||Nevermind figured it out based on your earlier postssql
Wednesday, March 21, 2012
Image Filepath in sql
Hi in my table i have a field which would store the file path of an image, the datatype is a varchar, and i wrote the following filepath in it but it didnt work, when i tried to call it up in the browser it didnt show, is the way i saved it below the right format?
C:\Millio\Documents\Project\Images\car.jpg
That's fine, but you will have to post some of your code so we can see why it might not be diplaying.
|||Hi thanks for responding this is the part where i am calling the image from;
<ItemTemplate>
<span><spanstyle="font-size: 14pt">
<asp:ImageID="Image1"ImageUrl='<%# Eval("Images") %>'runat="server"/>
<br/>
|||
You should store the virtual path of your image in the database rather than the physical path.
If you use a physical path like the one you are showing, you will need to use an HttpHandler to stream the image to the browser. The img tag takes a url value for the src attribute, so you could move the images to a folder within your web site, and reference them with a virtual path. Or if Project is already your virtual directory (the root folder for your web site), the path that you should store in the database is "images/car.jpg" or "~/images/car.jpg". Both will work, but the second one is ASP.NET specific, and can only be used when setting the ImageURL property of an asp server control. I would opt for the first one, just in case I decided to convert the site to PHP.
Or more realistically, decide to use the value to build up the src attribute of an <img> tag in code, and don't bother with a server control.
Hi Mike the reason i did it that way is because i am using a user control to load up my pages, and i didnt want to have to make a page for each category, i will show you what i mean;
<%@.ControlLanguage="C#"AutoEventWireup="true"CodeFile="CategoryList.ascx.cs"Inherits="CategoryList" %>
<scriptrunat="server">
string _Category = "washing machines";
public string Category
{
get { return _Category; }
set { _Category = value; }
}
protected void DataList1_SelectedIndexChanged(object sender, EventArgs e)
{
Label ID = (Label)DataList1.SelectedItem.FindControl("categoryIDLabel");
// Label AD = (Label)DataList1.SelectedItem.FindControl("PriceLabel");
Label MD = (Label)DataList1.SelectedItem.FindControl("categoryNameLabel");
Trace.Write("category " + ID.Text);
//Trace.Write("Price " + AD.Text);
Trace.Write("categoryName " + MD.Text);
Session["scategoryID"] = ID.Text;
//Session["scategorydescription"] = AD.Text;
Session["scategoryName"] = MD.Text;
}
protected void Page_Load(object sender, EventArgs e)
{
SqlDataSource1.SelectParameters["categoryName"].DefaultValue = _Category;
}
</script><asp:DataListID="DataList1"runat="server"BackColor="White"BorderColor="Transparent"
BorderStyle="None"BorderWidth="1px"CellPadding="4"DataSourceID="SqlDataSource1"
ForeColor="Black"GridLines="Horizontal"OnSelectedIndexChanged="DataList1_SelectedIndexChanged">
<FooterStyleBackColor="#CCCC99"ForeColor="Black"/>
<SelectedItemStyleBackColor="White"Font-Bold="True"ForeColor="White"Font-Italic="False"Font-Overline="False"Font-Strikeout="False"Font-Underline="False"/>
<HeaderStyleBackColor="#333333"Font-Bold="True"ForeColor="White"/>
<SeparatorStyleBackColor="Black"BorderColor="Black"BorderStyle="Solid"BorderWidth="2px"/>
<AlternatingItemStyleBackColor="White"Font-Bold="False"Font-Italic="False"Font-Overline="False"
Font-Strikeout="False"Font-Underline="False"/>
<ItemTemplate>
<span><spanstyle="font-size: 14pt">
<asp:ImageID="Image1"ImageUrl='<%# Eval("categoryImage") %>'runat="server"/>
<br/>
<asp:LabelID="categoryNameLabel"runat="server"Text='<%# Eval("categoryName") %>'ForeColor="DimGray"Font-Size="11pt"Font-Names="Trebuchet MS"></asp:Label><br/>
<br/>
<spanstyle="color: black"></span>
<asp:LabelID="CategoryIDLabel"runat="server"Visible="False"Text='<%# Eval("categoryID") %>'ForeColor="DimGray"Font-Size="11pt"></asp:Label><br/>
<br/>
<asp:LabelID="categoryDescriptionLabel"runat="server"Visible="True"Text='<%# Eval("categoryDescription") %>'ForeColor="DimGray"Font-Size="11pt"></asp:Label><br/>
<br/>
<br/>
</ItemTemplate></asp:DataList>
<asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:streamConnectionString %>"
SelectCommand="SELECT [categoryID], [categoryImage], [categoryName], [categoryDescription] FROM [Categories] WHERE ([categoryName] = @.categoryName)">
<SelectParameters>
<asp:ParameterName="categoryName"Type="string"/>
</SelectParameters></asp:SqlDataSource>
Monday, March 12, 2012
I'm confused with the non-unicode
a varchar field using asp page, it accepted the characters and
displayed correctly. It is good for me, but i was wondering what
exactly non-unicode is and why acting like that way(I expected to
receive strange characters in the feedback asp page but i didn't). Can
anyone tell me the reason?What is the collation of the column in the table? Also, did you try
comparing two columns with that data?
MC
"jane" <bidepan@.msn.com> wrote in message
news:1167926378.282209.127980@.6g2000cwy.googlegroups.com...
>I was confused with the non-unicode when i insert chinese characters in
> a varchar field using asp page, it accepted the characters and
> displayed correctly. It is good for me, but i was wondering what
> exactly non-unicode is and why acting like that way(I expected to
> receive strange characters in the feedback asp page but i didn't). Can
> anyone tell me the reason?
>|||Thanks for your reply MC, it's all default setting. I can't understand
your other question. It appears to be like ऒझ stored in the
database but it is displayed correctly(the correct character)in asp
pages. what i'm conserning is why the Unicode data can be stored in a
varchar(for non-Unicode) column and retrieved correctly, which i
suppose should not.
On Jan 4, 1:03 pm, "MC" <marko.NOSPAMc...@.gmail.com> wrote:
> What is the collation of the column in the table? Also, did you try
> comparing two columns with that data?
> MC
> "jane" <bide...@.msn.com> wrote in messagenews:1167926378.282209.127980@.6g2000cwy.googlegroups.com...
>
> >I was confused with the non-unicode when i insert chinese characters in
> > a varchar field using asp page, it accepted the characters and
> > displayed correctly. It is good for me, but i was wondering what
> > exactly non-unicode is and why acting like that way(I expected to
> > receive strange characters in the feedback asp page but i didn't). Can
> > anyone tell me the reason... Hide quoted text -- Show quoted text -|||Well, basically you're reading the same characters you inserted. My second q
was, did you try comparing on those characters? For example:
Table1 has col1 varchar(100)
Table2 has col2 varchar(100)
Insert same string in both tables (chinese chars). Then see what happens
when you say WHERE col1 = col2 or something like that (thats what I meant by
comparing values). Try the same thing with parameter and comparing values
in columns to parameter...
MC
"jane" <bidepan@.msn.com> wrote in message
news:1167936168.510779.204100@.s80g2000cwa.googlegroups.com...
> Thanks for your reply MC, it's all default setting. I can't understand
> your other question. It appears to be like ऒझ stored in the
> database but it is displayed correctly(the correct character)in asp
> pages. what i'm conserning is why the Unicode data can be stored in a
> varchar(for non-Unicode) column and retrieved correctly, which i
> suppose should not.
> On Jan 4, 1:03 pm, "MC" <marko.NOSPAMc...@.gmail.com> wrote:
>> What is the collation of the column in the table? Also, did you try
>> comparing two columns with that data?
>> MC
>> "jane" <bide...@.msn.com> wrote in
>> messagenews:1167926378.282209.127980@.6g2000cwy.googlegroups.com...
>>
>> >I was confused with the non-unicode when i insert chinese characters in
>> > a varchar field using asp page, it accepted the characters and
>> > displayed correctly. It is good for me, but i was wondering what
>> > exactly non-unicode is and why acting like that way(I expected to
>> > receive strange characters in the feedback asp page but i didn't). Can
>> > anyone tell me the reason... Hide quoted text -- Show quoted text -
>
I'm confused with the non-unicode
a varchar field using asp page, it accepted the characters and
displayed correctly. It is good for me, but i was wondering what
exactly non-unicode is and why acting like that way(I expected to
receive strange characters in the feedback asp page but i didn't). Can
anyone tell me the reason?What is the collation of the column in the table? Also, did you try
comparing two columns with that data?
MC
"jane" <bidepan@.msn.com> wrote in message
news:1167926378.282209.127980@.6g2000cwy.googlegroups.com...
>I was confused with the non-unicode when i insert chinese characters in
> a varchar field using asp page, it accepted the characters and
> displayed correctly. It is good for me, but i was wondering what
> exactly non-unicode is and why acting like that way(I expected to
> receive strange characters in the feedback asp page but i didn't). Can
> anyone tell me the reason?
>|||Thanks for your reply MC, it's all default setting. I can't understand
your other question. It appears to be like ऒझ stored in the
database but it is displayed correctly(the correct character)in asp
pages. what i'm conserning is why the Unicode data can be stored in a
varchar(for non-Unicode) column and retrieved correctly, which i
suppose should not.
On Jan 4, 1:03 pm, "MC" <marko.NOSPAMc...@.gmail.com> wrote:[vbcol=seagreen]
> What is the collation of the column in the table? Also, did you try
> comparing two columns with that data?
> MC
> "jane" <bide...@.msn.com> wrote in messagenews:1167926378.282209.127980@.6g2
000cwy.googlegroups.com...
>
>|||Well, basically you're reading the same characters you inserted. My second q
was, did you try comparing on those characters? For example:
Table1 has col1 varchar(100)
Table2 has col2 varchar(100)
Insert same string in both tables (chinese chars). Then see what happens
when you say WHERE col1 = col2 or something like that (thats what I meant by
comparing values). Try the same thing with parameter and comparing values
in columns to parameter...
MC
"jane" <bidepan@.msn.com> wrote in message
news:1167936168.510779.204100@.s80g2000cwa.googlegroups.com...
> Thanks for your reply MC, it's all default setting. I can't understand
> your other question. It appears to be like ऒझ stored in the
> database but it is displayed correctly(the correct character)in asp
> pages. what i'm conserning is why the Unicode data can be stored in a
> varchar(for non-Unicode) column and retrieved correctly, which i
> suppose should not.
> On Jan 4, 1:03 pm, "MC" <marko.NOSPAMc...@.gmail.com> wrote:
>
Friday, February 24, 2012
Iif use
declare @.temp1 bit,
@.var1 varchar,
@.var2 varchar,
@.var3 varchar
select @.var1='testing', @.var2='testing2'
Select @.temp1 = Iif((@.var1 = @.var2), 1, 0)
select @.temp1
I get this error:
Line 9: Incorrect syntax near '='.
Any suggestions?
ThanksI belive yu are using IIF in the wrong context try:
case when @.var1 = @.var2 then 1 else 0 end|||declare @.temp1 bit,
@.var1 varchar,
@.var2 varchar,
@.var3 varchar
select @.var1='testing', @.var2='testing2', @.temp1=0
Select @.temp1 = case when @.var1 = @.var2 then 1 else 0 end
select @.temp1 as result
OK, I changed it to the codeabove. But now result comes back as 1, how is that possible since the 2 variables arent equal?|||try:
declare @.temp1 bit,
@.var1 varchar(10),
@.var2 varchar(10),
@.var3 varchar(10)
select @.var1='testing'
, @.var2='testing2'
, @.temp1=0
Select @.temp1 = case when @.var1 = @.var2 then 1 else 0 end
select @.temp1 as result|||That worked. Wonder why the first one didnt. Thanks!
Originally posted by Paul Young
try:
declare @.temp1 bit,
@.var1 varchar(10),
@.var2 varchar(10),
@.var3 varchar(10)
select @.var1='testing'
, @.var2='testing2'
, @.temp1=0
Select @.temp1 = case when @.var1 = @.var2 then 1 else 0 end
select @.temp1 as result|||By default Varchar (or Char, NChar, NVarchar, etc.) is a 1 character string. Adding the (10) makes it a 10 byte string.