[+] Hacked By King_Wolf

[-] http://kr4lkurt.blogspot.com/

[+] king_wolf@hotmail.de 

[-] Ooops! Stop War israel!

[+] Linux aries 2.6.29-gentoo-r5 #1 SMP Sun Jul 5 23:14:10 CEST 2009 x86_64 Quad-Cor
e AMD Opteron(tm) Processor 2350 AuthenticAMD GNU/Linux uid=0(root) gid=0(root)

[-] Spc : MiyaChung , SusKuN , Thehacker , MadHunter, RobiN , By_WiwaRo , K1ngDeviL

[+] We are Muslim Hacker's

Library 4 Web » SQL insert increment DateAdd


Sep 11 2009

SQL insert increment DateAdd

Category: SQLtaitran @ 10:46 pm

It requires increment date by one day into datetime field to illustrate that records has been entered from time to time.  

DECLARE @CNT INT
DECLARE @Barcode VARCHAR(13)

DECLARE UpdateCursor CURSOR FOR
 SELECT Barcode FROM ViewProducts -- WHERE Barcode = @Barcode

SET @CNT = 1

OPEN UpdateCursor
FETCH NEXT FROM UpdateCursor INTO @Barcode

WHILE @@FETCH_STATUS = 0   
 BEGIN
   
  SELECT  @CNT = @CNT + 1
  
  UPDATE ViewProducts
  SET ModifyTime =  DATEADD( dd , @CNT,  GETDATE()) 
  WHERE Barcode = @Barcode
  
  FETCH NEXT FROM UpdateCursor INTO @Barcode
  
 END
 --FETCH NEXT FROM UpdateCursor INTO @Barcode
CLOSE UpdateCursor   
DEALLOCATE UpdateCursor

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks

Tags: , , ,

Leave a Reply