SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Urgent help required with '^' operator
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ahmeds08
Aged Yak Warrior

India
649 Posts

Posted - 09/25/2012 :  04:59:25  Show Profile  Send ahmeds08 a Yahoo! Message  Reply with Quote
Hi All,
I am getting this error when this query is executed:
The data types numeric and int are incompatible in the '^' operator.

query is:
select 13.2846176*(10/5)^4 -24.27436623*(20/5)^3 + 14.27967309*(30/5)^2 + -2.455442334*(40/5) + 0.114953113

Please help.

senthil_nagore
Flowing Fount of Yak Knowledge

India
1007 Posts

Posted - 09/25/2012 :  05:28:50  Show Profile  Visit senthil_nagore's Homepage  Send senthil_nagore a Yahoo! Message  Reply with Quote
'^' Denotes XOR operator in T-sql, you have to use Power() function


select power(13.2846176*(10/5),4 )- power(24.27436623*(20/5),3) + power(14.27967309*(30/5),2) + -2.455442334*(40/5) + 0.114953113

Senthil Kumar C
------------------------------------------------------
MCITP - Database Administration SQL SERVER 2008
MCTS - Database Development SQL SERVER 2008
Go to Top of Page

ahmeds08
Aged Yak Warrior

India
649 Posts

Posted - 09/25/2012 :  05:39:30  Show Profile  Send ahmeds08 a Yahoo! Message  Reply with Quote
quote:
Originally posted by senthil_nagore

'^' Denotes XOR operator in T-sql, you have to use Power() function


select power(13.2846176*(10/5),4 )- power(24.27436623*(20/5),3) + power(14.27967309*(30/5),2) + -2.455442334*(40/5) + 0.114953113

Senthil Kumar C
------------------------------------------------------
MCITP - Database Administration SQL SERVER 2008
MCTS - Database Development SQL SERVER 2008




Thanks a lot for the help.
I have run the query with some additions to it,but i get error
"max functions requires on argument"
query is:
select min(max(power(13.2846176*(10/5),4 )- power(24.27436623*(20/5),3) + power(14.27967309*(30/5),2) + -2.455442334*(40/5) + 0.114953113,0),1))

please help please.
Go to Top of Page

senthil_nagore
Flowing Fount of Yak Knowledge

India
1007 Posts

Posted - 09/25/2012 :  05:55:25  Show Profile  Visit senthil_nagore's Homepage  Send senthil_nagore a Yahoo! Message  Reply with Quote
What you tring to achieve it? min/max requires only one expression..

Check this

http://msdn.microsoft.com/en-us/library/ms187751.aspx

Senthil Kumar C
------------------------------------------------------
MCITP - Database Administration SQL SERVER 2008
MCTS - Database Development SQL SERVER 2008

Edited by - senthil_nagore on 09/25/2012 05:55:50
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000