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 |
|
sureshkumar
Starting Member
11 Posts |
Posted - 2004-07-20 : 11:16:27
|
| Hi The following table will product size in product_master will have different data like 4s,10,40gm, 40 ml like differentif case ='s'then(rate / cast(left(product_size,len(product_size)-1) as int)) elserateendcomplete query is given below.select sum((closing_stock * (case when lower(right(product_size,1))='s' then (rate / cast(left(product_size,len(product_size)-1) as int)) else rate end))) as stock_valuefrom stock s, product_master pwhere s.product_code=p.product_codewhile executing error "Syntax error converting the nvarchar value '450gm' to a column of data type int." getting following error messageReply me urgent thanks and regardssuresh kumar.a |
|
|
Kristen
Test
22859 Posts |
Posted - 2004-07-20 : 11:28:39
|
Looks like you have got "450gms" somewhere in your dataSELECT product_sizeFROM product_masterWHERE product_size LIKE '%s' AND IsNumeric(LEFT(product_size, LEN(product_size)-1)) = 0 "Reply me urgent"Why, are you willing to pay my expediting fee?Kristen |
 |
|
|
sureshkumar
Starting Member
11 Posts |
Posted - 2004-07-21 : 00:58:10
|
| 450 ml, 4500ml, 450gm ,450ml sample type which iam having even Null values are there. Another Field Type is Nvarchar(10).Now its showing error even for 30gm product size. |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2004-07-21 : 01:27:39
|
| None of those will cause this query to fail. Did you run my query?Kristen |
 |
|
|
|
|
|