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 |
usafelix
Posting Yak Master
165 Posts |
Posted - 2015-01-08 : 05:11:27
|
Anyone can help me ?When i run this query after to prompt error message in below "Error converting data type nvarchar to numeric. trx_dat.unit_price is nvarchar(20)trx_dat.qty numeric field. ------------------------------ SQL query CAST(CONVERT(numeric(36, 2), dbo.trx_dat.unit_price * dbo.trx_dat.item_qty AS numeric(36, 2)) AS total_commissionHow to edit this query can be get the total commission ? |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2015-01-08 : 07:05:48
|
that's not valid syntax. Post the entire query. |
|
|
viggneshwar
Yak Posting Veteran
86 Posts |
Posted - 2015-01-08 : 08:47:45
|
CAST(CONVERT(numeric(36, 2), dbo.trx_dat.unit_price AS numeric(36, 2)) * dbo.trx_dat.item_qty AS total_commissionRegardsViggneshwar A |
|
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2015-01-08 : 08:58:35
|
that's not a query; that's an expression. And, the expression has invalid syntax! e.g. If I try to use your expression in a query:select CAST(CONVERT(numeric(36, 2), dbo.trx_dat.unit_price AS numeric(36, 2)) * dbo.trx_dat.item_qty AS total_commissionfrom dbo.trx_dat Intellisense correctly underlines the first keyword "AS" in red, since the syntax is invalid. Because the syntax is invalid, I cannot run a query using your expression. That means that I cannot get the error "Error converting data type nvarchar to numeric." Since you are getting this error, your query must be different somehow.Please post the whole query, starting with a SELECT and ending with a semi-colon. |
|
|
|
|
|
|
|