Either declare set1 and set2 as floats instead of integers or cast them to floats as part of the calculation:
SET @weight= CAST(@set1 AS float) / CAST(@set2 AS float);
More Related Contents:
- How to delete the records by using SQL [closed]
- How do I obtain a Query Execution Plan in SQL Server?
- MySQL: Alternatives to ORDER BY RAND()
- Left Join With Where Clause
- Remove Identity from a column in a table
- efficient way to implement paging
- How to select unique records by SQL
- SQL Server – transactions roll back on error?
- Key value pairs in relational database
- Difference between a User and a Login in SQL Server
- For Nvarchar(Max) I am only getting 4000 characters in TSQL?
- Record returned from function has columns concatenated
- Rails 3 execute custom sql query without a model
- How to Select a substring in Oracle SQL up to a specific character?
- passing table and column name dynamically using bind variables
- Conditional SUM on Oracle
- SQL Use alias in Where statement
- PostgreSQL JOIN with array type with array elements order, how to implement?
- Trim trailing spaces with PostgreSQL
- Nth max salary in Oracle
- What does sp_reset_connection do?
- Replace first occurrence of substring in a string in SQL
- How to correctly insert newline in nvarchar [duplicate]
- Check whether string is a date Postgresql
- How to measure the execution time of a query on Spark
- How do you copy a record in a SQL table but swap out the unique id of the new row?
- Using IF ELSE statement based on Count to execute different Insert statements
- Convert bigint to datetime
- Replacing NULL and empty string within Select statement
- Why isn’t row level security enabled for Postgres views?