Forum Replies Created

Viewing 11 posts - 16 through 26 (of 26 total)

  • RE: Ordereing an IP address

    Hello,

    here is a sample how to solve this

    create function dbo.iptext2no(@iptext varchar(16))

    returns bigint

    as

    begin

    declare @pPosFrom int, @pPosTo int, @pWorkstring varchar(16)

    set @pPosFrom = 0

    set @pWorkstring = ''

    while @pPosFrom < len(@iptext)+1

    begin

    set @pPosTo = charindex('.',@iptext,@pPosFrom)

    if...

  • RE: Find Last Day of Month

    Hello,

    this can be done by using the dateadd and datediff functions like this:

    declare @pSampleDate smalldatetime

    set @pSampleDate = CONVERT(SMALLDATETIME, '2008-01-01',120)

    Select @pSampleDate, dateadd(dd,-1,

    ...

  • RE: Query to get all days of a specific month and year

    It depends on how you want to access to this functionality.

    the base code can be like

    use AdventureWorks

    go

    DECLARE @pYear INT, @pMonth INT

    DECLARE @pDateWork SMALLDATETIME, @pDateControl SMALLDATETIME

    SET @pYear = 2008

    SET @pMonth...

  • RE: how to display the table content in column

    Need this really to be done by SQL.

    There are some easier ways to do this.

    Like OLAP or Reporting Services or just like MTRANS Function from Excel.

  • RE: Calculated member with strange behavior

    I'll think you need as distint count like

    DISTINCTCOUNT( [Sale[Docs].[Products].[Doc ID].Members )

    I'm not sure if you need members or Currentmenbers at the end of this Statement.

    W. Lengenfelder

  • RE: Using "go" in "if-clause

    You can try to run your statements as string with the exec statement like

    if (select nDbSubVersion from tblVersion) = 113

    begin

    begin transaction

    ...

  • RE: Optimizing SQL Query

    as the people posted before:

    I would also avoid the use of a funktion in the From or Where Cause.

    Especially in the case of the function is not scalar.

    Further you should...

  • RE: SQL Performance Issue - Urgent

    You can look at the execution plan. Here you can see if the SQL Server processes the Statement as same as sql 2000 does. With SQL Server 2000 i had...

  • RE: SQL Performance Issue - Urgent

    Did you migrate a existing database to SQL Server 2005.

    In this case you should ensure to update the database statistics.

    You can do this with the stored Procedure [p][font="Courier New"]sp_updatestats[/font]

    [/p]

  • RE: The Cost of Function Use In A Where Clause

    you can also try this

    [font="Courier New"]

    SELECT *

    FROM table_name

    WHERE Created_Date BETWEEN

    DATEADD(d,DATEDIFF(d,0,@varDate),0)

    AND DATEADD(ms, -3,DATEADD(d,DATEDIFF(d,0,@varDate)+1,0))

    [/font]

  • RE: The Cost of Function Use In A Where Clause

    Thanks for this good Article

    If you wont use time data for searching you need to cut off the time information.

    The query can look like:

    [font="Courier New"]WHERE PlacedOnQueue <= DateAdd(mm,-30,DateAdd(dd,DateDiff(dd,0,GetDate()),0)) [/font]

Viewing 11 posts - 16 through 26 (of 26 total)