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
 SQL Server Development (2000)
 Creating a strange stored procedure involving dates

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-10-11 : 10:35:51
Alex Bienz writes "Hi there,

I need to create a stored procedure that inserts into a table with only about 5 different fields.

2 Fields I can hardcode, as these will not change, but the other three will change each time the SP is run, they are Value, Date, and Time.

Value can be determined from a select statement...

SELECT (SUM(Price)/17)*1.886 AS Value
FROM v_Search

Date and Time however will be a bit more tricky I feel, because these two values aren't stored as Datetime datatypes, but instead as Char.

Date is a Char of 8 characters, and Time is 6
typical values for these two fields are 20010520 for date, and 191510 for time, I'm sure you can see how these may have been derived. YYYYMMDD and HHMMSS

Anyway back to my problem. I need a stored procedure that doesn't take any input except from other tables, and that can dynamically generate the date and time in the above format to insert into the target table

Any clues will be much appreciated

Cheers,
Alex."
   

- Advertisement -