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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Dummy Field in Temp table

Author  Topic 

real_pearl
Posting Yak Master

106 Posts

Posted - 2004-06-02 : 03:55:33
I want to create a dummy field in temporary table that can hold floating values. How I may do this

select employeeid, bin = 0 into ##tmp from employees

update ##tmp
set bin = 85.114
where user_id = 1

select * from ##tmp
drop table ##tmp

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2004-06-02 : 04:23:15
No problemo:


select employeeid, bin = cast(0 as numeric(10,3)) into ##tmp from employees

update ##tmp
set bin = 85.114
where user_id = 1

select * from ##tmp
drop table ##tmp


OS
Go to Top of Page

real_pearl
Posting Yak Master

106 Posts

Posted - 2004-06-02 : 07:35:55
Thanks I have done this in the following way
declare @sql varchar(5000)
select @sql = 'select user_id, bin = ''000.000'' into ##tmp from yp_users'
print @sql
exec(@sql)

update ##tmp
set bin = 85.114
where user_id = 1

select * from ##tmp
drop table ##tmp
Go to Top of Page
   

- Advertisement -