Question : Trying to insert datetime into a field

Hi
Im trying to add a datestamp to this SProc - so that it records once the time of the run to get counts.

But this isnt working...

So table should be :

docs  secure KnwlBank Test RunTime
100    20        20              14    23/09/08 15:00
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
Create procedure usp_CheckedOut_Mabel
as
Declare 
@docs int, 
@secure int, 
@test int, 
@knwlbank int
@RunTime datetime
 
select @docs =		count(checkedout) from docs.mhgroup.docmaster
					where checkedout = 'y'
 
select @secure =	count(checkedout) from secure.mhgroup.docmaster 
					where checkedout = 'y'
 
select @knwlbank =	count(checkedout) from knowledgebank.mhgroup.docmaster
					where checkedout = 'y'
 
select @test	=	count(checkedout) from test.mhgroup.docmaster
					where checkedout = 'y'
 
SELECT @RunTime	=	CONVERT(VARCHAR(20), GETDATE(), 100)
 
INSERT	INTO CheckedOut_Mabel ( Docs, Secure, Knwlbank, Test, RunTime) 
		VALUES (@docs, @secure, @knwlbank, @Test, @RunTime)
Open in New Window Select All

Answer : Trying to insert datetime into a field

why the convert Varchar?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
Create procedure usp_CheckedOut_Mabel
as
Declare 
@docs int, 
@secure int, 
@test int, 
@knwlbank int
@RunTime datetime
 
select @docs =            count(checkedout) from docs.mhgroup.docmaster
                              where checkedout = 'y'
 
select @secure =      count(checkedout) from secure.mhgroup.docmaster 
                              where checkedout = 'y'
 
select @knwlbank =      count(checkedout) from knowledgebank.mhgroup.docmaster
                              where checkedout = 'y'
 
select @test      =      count(checkedout) from test.mhgroup.docmaster
                              where checkedout = 'y'
 
SELECT @RunTime      =      GETDATE()
 
INSERT      INTO CheckedOut_Mabel ( Docs, Secure, Knwlbank, Test, RunTime) 
            VALUES (@docs, @secure, @knwlbank, @Test, @RunTime)
Open in New Window Select All
Random Solutions  
 
programming4us programming4us