473,583 Members | 3,114 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sql Server datatype values issue

2 New Member
Hi,

I have come across a strange scenario while executing a query. I was surprised by the way Sql Server was executing the query.

Quote:
Expand|Select|Wrap|Line Numbers
  1. SELECT TOP 10 MR.MerchantContactFirstName + ' ' + MR.MerchantContactLastName AS MerchantName, 
  2. AISLTrans.DeviceID,AISLTrans.TransactionID, AISLTrans.CardNumber, AISLTrans.TransactionDateTime, 
  3. AISLTrans.TransactionStatus, AISTRNSTYPE.TransactionType AS TransactionRequestType,AISLTrans.TransactionAmount,
  4. (AISLTrans.BasePointEarn+AISLTrans.BonusPointEarn)AS 'Point Awarded'
  5. FROM AISLoyaltyTransactions AISLTrans INNER JOIN 
  6. MerchantRegistration MR 
  7. ON AISLTrans.MerchantID = MR.MerchantID INNER JOIN 
  8. AISTransactionTypes AISTRNSTYPE 
  9. ON AISLTrans.ProcessingCode = AISTRNSTYPE.ProcessingCode AND 
  10. AISLTrans.TransactionType = AISTRNSTYPE.MessageType WHERE AISLTrans.TransactionType = 0200 
  11. AND AISLTrans.ProcessingCode = 071000 ORDER BY AISLTrans.TransactionDateTime DESC

In above query the field ISLTrans,Transa ctionType works fine for all the values except 0200 it accepts all interger values though the field type is of varchar.

But when I give the value as 0200 it throws exception saying cannot convert varchar to int.

I am looking for why the query is still executing though I am providing integer value instead of varchar and if it is executing why its not accepting all the integer values which I provide.

Thanks,
Praveen Nelge
Jul 17 '14 #1
1 1247
Rabbit
12,516 Recognized Expert Moderator MVP
SQL Server will try to implicitly convert data types to match. You should not rely on this in your queries. You should explicitly make sure that the data types match, otherwise you can run into issues as you are now.

Failure to convert the data type from char to int can come about a few different ways. It could be an overflow issue, or an invalid character issue, or a decimal, etc. There's no way to know without looking at the actual data it is trying to convert.
Jul 17 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2443
by: Miranda johnsen | last post by:
Hello, I need some help with passing a value from my login authorization page. The authorization is done with the code below (it works), but I need the 'uName' value passed on when the window.location is activated. I code my ASP with JavaScript NOT vbscript so please no &'s. And yes I know I should be using a DSN-less connection!...
3
1844
by: | last post by:
Hi, When I create a table in MS access 2000 with SR3 using a standard SQL Create command The BOOL (YesNo) columns are NOT checkboxes, they are ints. When I create a table using the designer the BOOL YESNO fields are checkboxes.
1
3280
by: Programmer | last post by:
Hi All Here is my problem I'm using a SQLDataAdapter and DataSet I use the method FillSchema(myDataset, SchemaType.Source) The problem is that when i Check the default Values of the Dataset i can see that the DefaultValue of the columns is system.dbnull!!!! But in SQL Server i have put as default values in a bigint field the '0' and
1
2409
by: Teddy | last post by:
Language: C Excel Reading Method: ExecuteReade I am currently running into a challenge reading excel data when datatype formats are different in the SAME column. It seems like datatype (in the OleDbDataReader schema) is set by the first data row and that causes a problem if any of the subsequent rows in that column holds a diffrent datatype...
2
2148
by: Mark Rae | last post by:
Hi, Can anyone please point me to a definitive mapping of SQL Server 2000 datatypes to C# datatypes? I'm currently using the mapping below, but I'm sure some aren't correct... BigInt, int Binary, object Bit, bool
2
2080
by: Steve Franks | last post by:
In ASP.NET 2.0 you can now apparently do this: <asp:label runat="server" text="some browser" IE:text="any IE browser" IE5:text="the IE 5 browser" PIE:text="the Pocket PC browser" /> Now the tokens "IE5" and "PIE" are coming from the updated browser capabilities component. I'd like to do the same thing, but create my own tokens that have...
0
2218
by: Charles Leonard | last post by:
I am having yet another issue with Windows Server 2003. This time, the web service (a file import web service) appears to run except for one odd message: "ActiveX component can't create object". There are no other statements to indicate what object cannot be created. Otherwise, everything on the test Windows Server 2003 works fine—all...
0
1397
by: abdellatif | last post by:
hi all i have installed a 2 nodes cluster (active/passive)win2003 sp1 containing an exchange2003 virtual server and sqlserver2000(sp3) virtual server. everything work well, after 1 month the cluster fails because the password of the cluster service account(and also sqlagent and sqlserver services) had expired, so i have midified the account...
5
4187
by: tjaink | last post by:
Hi I have a vc++ dll and its stored in Windows directory. I am using OS Windows 2003 server. And i am using ASP Legacy application migrated from NT to Windows 2003 server. Now there is no problem with accessing the application. But the only issue that i am facing is, i am not able to access that vc++ dll which i stored in Windows directory....
3
1347
by: Rohit | last post by:
I am using SQL Server Express Edition with ASP.NET. I want to know which data type to use for storing large articles.
0
8184
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8328
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7936
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6581
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5701
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5375
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3820
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3845
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1434
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.