please forgive me if this is stupid, but I was wondering if anybody knows or has a simple way of inserting a row for each of the current month into a table? Can I do this without a looping construct in a stored?
do u want to populate a table with all the months starting from 1 to 12? if so this is one way to do it.
Create Table #TEMP (month1 tinyint)
Declare @i int
set nocount on
SET @i=1
while @i<=12
begin
insert into #temp (month1) values(@i)
set @i=@i+1
end
set nocount off
select * from #temp
GO
DROP TABLE #TEMP
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.