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 |
|
tvspsekhar
Starting Member
20 Posts |
Posted - 2010-03-24 : 22:12:09
|
| pl help me in correcting the syntax for print.declare @a as int, @b as int, @c as int;set @a=100set @b=230set @c=(@a/@b)print 'value of c=',@c Error message;Msg 102, Level 15, State 1, Line 7Incorrect syntax near ','.tvspsekhar |
|
|
namman
Constraint Violating Yak Guru
285 Posts |
Posted - 2010-03-24 : 22:34:54
|
| can not implicit convertdeclare @a as int,@b as int,@c as int set @a=100set @b=230set @c=(@a/@b)print 'value of c='+CONVERT(varchar, @c) |
 |
|
|
tvspsekhar
Starting Member
20 Posts |
Posted - 2010-03-24 : 22:40:15
|
| Thank U namman. But the value of c is coming as 0declare @a as int,@b as int,@c as int,@temp varchar(50)set @a=100set @b=230set @c=(@a/@b)set @temp = 'value of c='+CONVERT(varchar, @c)print @temp --'value of c=',@c on execution:value of c=0tvspsekhar |
 |
|
|
namman
Constraint Violating Yak Guru
285 Posts |
Posted - 2010-03-24 : 23:16:29
|
| using decimaldeclare @a as decimal(5,2),@b as int,@c as decimal(5,2) set @a=100set @b=230set @c= @a/@bprint 'value of c='+CONVERT(varchar, @c) value of c=0.43 |
 |
|
|
tvspsekhar
Starting Member
20 Posts |
Posted - 2010-03-24 : 23:40:46
|
| Thank U very much Mr nammtvspsekhar |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|
|
|