User Profile

Collapse

Profile Sidebar

Collapse
clvandyke
clvandyke
Last Activity: Dec 6 '11, 03:30 PM
Joined: Oct 20 '11
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Please feel free to alter and use as needed

    Here is a snipet of code I use to create a calendar table. I modified it to return only weekends between @StartDate and @EndDate

    Code:
     IF (EXISTS(select * from tempdb..sysobjects where name LIKE '#Calendar%'))
    	drop table #Calendar
    
    
    create table #Calendar
     (
     DOW varchar(10),
     #CalendarDate datetime,
     Holiday Bit default
    ...
    See more | Go to post

    Leave a comment:


  • This works in SQL 2008

    Jennifer,

    Not sure which version of SQL you are using but in SQL Server 2008 there is a function NEWID. It can be used in the ORDER BY clause:

    Code:
    SELECT *
    FROM
    TblTestBank 
    WHERE
    Tag = 'Review'
    ORDER BY NEWID()
    This returns a list in a different order each time it is run.
    See more | Go to post

    Leave a comment:


  • Try this

    Code:
    DECLARE @Email varchar(50)
    SET @Email = '"vini katyal" <vinikatyal@yahoo.com>'
    SELECT
    SUBSTRING(@Email,
    charindex('<',@Email),
    LEN(@Email)) as [email]
    See more | Go to post
    Last edited by NeoPa; Oct 22 '11, 12:18 PM. Reason: Added mandatory [CODE] tags for you

    Leave a comment:

No activity results to display
Show More
Working...