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,514
  • 5
  • 36
  • 87

2 Answers2

1

Good link on SQL Date functions:

SQLTeam Dates

PMC
  • 4,698
  • 3
  • 37
  • 57
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
  • 14,639
  • 11
  • 62
  • 110
  • 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