3

how can i pass 3 parameters to form a date in sql for example @year @month @day

Basically my program sends the parts of the date seperatly and i want them to be joined in the stored procedure.

MyHeadHurts
  • 1,444
  • 5
  • 35
  • 87

2 Answers2

1

Good link on SQL Date functions:

SQLTeam Dates

PMC
  • 4,648
  • 3
  • 35
  • 55
1

Here is SO answer to a similar question.

CAST(CAST(y AS varchar) + '-' + CAST(m AS varchar) + '-' + CAST(d AS varchar) AS DATETIME)

(I assume you know how to pass 3 parameters to stored procedure)

Community
  • 1
  • 1
Dani
  • 13,910
  • 11
  • 59
  • 101
  • hmmm it works but i cant get a dateadd to work in there is it possible to subtract the generated year by a parameter – MyHeadHurts Jan 07 '11 at 20:18