Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 1234»»»

Arithmetic 1 Expand / Collapse
Author
Message
Posted Tuesday, February 28, 2012 8:41 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, November 6, 2014 1:00 PM
Points: 5,333, Visits: 25,277
Comments posted to this topic are about the item Arithmetic 1

If everything seems to be going well, you have obviously overlooked something.

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
Post #1259233
Posted Tuesday, February 28, 2012 8:43 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, December 18, 2014 9:11 PM
Points: 1,302, Visits: 1,146
Good Question. Back to the basics. +1 to the total.
Post #1259235
Posted Tuesday, February 28, 2012 10:10 PM
Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Monday, December 8, 2014 5:37 AM
Points: 749, Visits: 967
Good Question....
Post #1259253
Posted Wednesday, February 29, 2012 12:38 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, December 15, 2014 8:05 AM
Points: 1,877, Visits: 518
Very interesting question. Learnt something new again.
Post #1259290
Posted Wednesday, February 29, 2012 1:37 AM
Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Monday, December 15, 2014 1:05 AM
Points: 672, Visits: 975
The explanation I see is that on answers 1,3,4,5,6 implicit data types conversion happens because of mixing INT and CHAR types.

On the answer 2, we just try to multiply 2 CHAR, therefore an error is raised up.

Good question!
Post #1259310
Posted Wednesday, February 29, 2012 1:41 AM
Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Friday, November 21, 2014 2:57 AM
Points: 748, Visits: 123
raulggonzalez (2/29/2012)
The explanation I see is that on answers 1,3,4,5,6 implicit data types conversion happens because of mixing INT and CHAR types.

On the answer 2, we just try to multiply 2 CHAR, therefore an error is raised up.

Good question!
Yeah, I have to agree, multiplying strings is the cause. It errors before it even tries to implicitly cast the answer to an int.
Post #1259314
Posted Wednesday, February 29, 2012 1:45 AM


UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: 2 days ago @ 5:55 AM
Points: 1,483, Visits: 8,545
I particularly like the fact that a QOTD was verified by several people before publication.

BrainDonor
Linkedin
Blog Site
Post #1259316
Posted Wednesday, February 29, 2012 1:48 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: 2 days ago @ 10:18 AM
Points: 1,057, Visits: 2,359
It gives me this error on the 2nd block

Msg 8117, Level 16, State 1, Line 3
Operand data type char is invalid for multiply operator.

I guess E stands for ERROR?



ww; Raghu
--
The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.
Post #1259319
Posted Wednesday, February 29, 2012 1:54 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 12:49 AM
Points: 2,620, Visits: 2,467
This kind of error also is independent from version of sqlserver.
You can not use - * / operators with chars
Post #1259329
Posted Wednesday, February 29, 2012 2:34 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Thursday, December 18, 2014 10:22 AM
Points: 1,830, Visits: 6,646
Yet another question that tells us not to rely on implicit conversion...
Post #1259357
« Prev Topic | Next Topic »

Add to briefcase 1234»»»

Permissions Expand / Collapse