Forum Replies Created

Viewing 15 posts - 91 through 105 (of 141 total)

  • RE: 100,000 random numbers without cursor

    Correct me if I'm wrong, but I thing using Sergiy's solution of

    SET ROWCOUNT @RowsToGet

    SELECT Number

    FROM Numbers

    ORDER BY NEW_ID()

    SET ROWCOUNT 0

    would contradict the RANDOMability (if that's a word

  • RE: QUERY

    DATEADD(year,10,EffectiveDate) > (DATEADD(mm, 1,MonthReported) - 1)

    However, if you want it up to the second, use

    CAST(convert(varchar(10),(DATEADD(mm, 1,MonthReported) - 1), 101) + ' 11:59:59 PM' as datetime)

     

  • RE: Converting integer to datetime

    1900 is a leap year. All years divisible by 4 is a leap year. Right? Or did I miss something?

  • RE: Help on a Query on sysjobshistory

    Use your column 'Last Run Date' to determine the last job run. Its already a valid date.

    select distinct j.Name collate Latin1_General_CI_AS as 'Job Name',

       server as 'Server Name',

    Max(CAST((

    SUBSTRING((Convert(varchar(10),h.run_date) +...

  • RE: Can cursor be avoided using a table functioin?

    Using the same logic and how Sergiy puts it...

    Create Function dbo.fn_NamePart(@FullName varchar(60), @NameType tinyint)

    returns varchar(30)

    as

    begin

    Declare @Return varchar(30)

    Select @Return = case @NameType

     when 1 then  Ltrim(Rtrim(Left(right(@Fullname, charindex(',' ,@Fullname)), len(right(@Fullname, charindex(',' ,@Fullname)))...

  • RE: Intentionally add spaces

    select cast(1 as char(6)) + '|' + 'Name...'

    1     |Name...

  • RE: Can cursor be avoided using a table functioin?

    What is the logic you used in your table-valued function? Try to use that within the select statement and avoid the function totally. Something like this...

    declare @FullName varchar(60)

    Set @Fullname = 'Kennedy,...

  • RE: Foreign Key across Databases?

    Lucky for you, Sergiy, you have less than 1GB of a problem in that situation. In my case, we have over 50 SQL Servers, with data spread in 10 dbases...

  • RE: Trigger on Last record

    I'm getting more confused, the farther I read thru the thread.

  • RE: SUM(Varchar Column). Is this Possible?

    CREATE TABLE [OrderComments] (

     [OrderID] [nchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [Comments] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL

    ) ON [PRIMARY]

    GO

    -- populate table

    create function ronald.fn_ConCatComments(@Orderid char(5))

    returns varchar(8000)

    as

    begin

     declare @Comments varchar(8000)

     set @Comments = ''

     select @Comments...

  • RE: how to EXEC with no output???

    "@results=@results Output"

    Ooops, didn't realize that.

  • RE: how to EXEC with no output???

    You still cannot output to a variable your results even when using sp_executesql.

     

  • RE: is string

    I stand corrected...

     

  • RE: Execute Query

    Select Max(LossDate) as LossDate

    INTO #GE_Claim_LossDate

    from GE_Claim

    Group By PolicyNumber, TableCode, SeriesCode

    GO

    Update T

    Set ClaimNumber = c.ClaimNumber,LastName = c.LastName,FirstName = c.FirstName,LossDate = c.LossDate,InClaimFile = 1

    From #tmp T

    Inner join GE_Claim c

    On T.PolicyNumber =...

  • RE: Server: Msg 7399, Level 16, State 1, Line 4

    There seems to be an interruption on your TCPIP connection. Are you using a wireless network?

Viewing 15 posts - 91 through 105 (of 141 total)