Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

stored proc to up date values

 
   Database Help (Home) -> Programming RSS
Next:  Exception reports  
Author Message
mcnewsxp

External


Since: Jun 19, 2008
Posts: 3



(Msg. 1) Posted: Tue Oct 19, 2010 10:01 am
Post subject: stored proc to up date values
Archived from groups: microsoft>public>sqlserver>programming (more info?)

i have a table that is used to get dates. the table needs to be
updated every year. the value for the first date in the first row is
set then the remaining 40 rows contain the previous row's date + 7.
the other column contains the year plus the week number. eg 201040.
this increments to 201052 then goes to 201120 then 201121 to 201139.
i'm looking for an smart example to do this each year with a stored
proc.
tia,
mcnewsxp

 >> Stay informed about: stored proc to up date values 
Back to top
Login to vote
Erland Sommarskog2

External


Since: May 30, 2004
Posts: 2061



(Msg. 2) Posted: Tue Oct 19, 2010 11:51 pm
Post subject: Re: stored proc to up date values [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

mcnewsxp (mcourter@mindspring.com) writes:
> i have a table that is used to get dates. the table needs to be
> updated every year. the value for the first date in the first row is
> set then the remaining 40 rows contain the previous row's date + 7.
> the other column contains the year plus the week number. eg 201040.
> this increments to 201052 then goes to 201120 then 201121 to 201139.
> i'm looking for an smart example to do this each year with a stored
> proc.

I'm afraid that I don't quite follow. It is a little bewildering that
the table only has 41 rows, but is updated yearly. Someone something is
missing it seems.

Then again, since this procedure is only yearly and there are so few rows,
there is not any need for anything smart, but a simple cursor would do.

How are the weeks numbered? ISO or as in the US? On which day does the
week start?

--
Erland Sommarskog, SQL Server MVP, esquel.RemoveThis@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx

 >> Stay informed about: stored proc to up date values 
Back to top
Login to vote
--CELKO--

External


Since: Jan 11, 2008
Posts: 1089



(Msg. 3) Posted: Wed Oct 20, 2010 8:14 am
Post subject: Re: stored proc to up date values [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

>> i'm looking for an smart example to do this each year with a stored proc. <<

I am also not sure just what you want, but why not do it once for 50
or 100 years in a table and forget about procedural code completely?
 >> Stay informed about: stored proc to up date values 
Back to top
Login to vote
Hugo Kornelis

External


Since: Jan 11, 2008
Posts: 440



(Msg. 4) Posted: Wed Oct 20, 2010 5:04 pm
Post subject: Re: stored proc to up date values [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Tue, 19 Oct 2010 10:01:28 -0700 (PDT), mcnewsxp wrote:

>i have a table that is used to get dates. the table needs to be
>updated every year. the value for the first date in the first row is
>set then the remaining 40 rows contain the previous row's date + 7.
>the other column contains the year plus the week number. eg 201040.
>this increments to 201052 then goes to 201120 then 201121 to 201139.
>i'm looking for an smart example to do this each year with a stored
>proc.
>tia,
>mcnewsxp


Hi mcnewsxp,

In addition to Erland's reply, please check out
http://sqlserver2000.databases.aspfaq.com/why-should-i-consider-using-...auxilia

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
 >> Stay informed about: stored proc to up date values 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Passing Multi List Parameter Values To Stored Proc - Using SQL Server 2005 I am creatiing a stored procedure to create a data source for a report. The parameter value can have multiple values separated by a semi-colon. The code works fine except when the user does not pass in a value. I can get it to....

Can a stored proc call another stored proc? - and if so what happens if I am within a cursor, can I come back to it and continue? Thanks.

stored proc help - hey all, i'm trying to retrieve to fields from a database so i can use thru out my procedure. if i use SELECT INTO a local table do i have to define the fields for that local table? is there another way? thanks, rodchar

Stored Proc Help... - Here is what I have so far.... set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go CREATE PROCEDURE [dbo].[type_check2] @name VARCHAR(30), @result VARCHAR(3) OUTPUT AS DECLARE @namecount int BEGIN SET NOCOUNT ON; SELECT @namecount =..

how do i call a stored proc that looks like this from ADO... - how do i call a stored proc that looks like this from ADO.NET? ALTER PROCEDURE new_pzGetIDList ( @foo varbinary(8) ) i have it as a System.Byte[4] in C#
   Database Help (Home) -> Programming All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]