Forum Replies Created

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

  • RE: Distinct with no order

    you've mentioned that you've solved it many ways. Can you explain how did you do that ?

  • RE: Value from Query

    check whether this works...

     

    CREATE PROCEDURE USPCHECK_TEST (@MONTH VARCHAR(15))

    AS

    BEGIN

    SET NOCOUNT ON

    DECLARE @test-2 NUMERIC(10,2)

    DECLARE @sql VARCHAR(2000)

    IF OBJECT_ID('TEMPDB..##TMP') IS NOT NULL

    BEGIN

     TRUNCATE TABLE ##TMP

     DROP TABLE ##TMP

    END

    SET @sql =...

  • RE: Value from Query

    y r u using the below statement ? what is the result u r expecting from the below query ?? 

    Select @test-2 = @Month from LockDatabase where CompanyID='BM' and Finyear='2006-2007'

     

    Will this...

  • RE: Join Query- Help!

    Try this...

     

    SELECT A.*

    FROM CUSTOMERBRANCH  A

    WHERE NOT EXISTS (SELECT * FROM [SERVER].[DATABASE].DBO.TBCUSTBRANCH B WHERE A.ACCPACCODE = B.ACCPACCODE)

  • RE: How to delete a row if date and time are older than a spacific date and time

    You can also try this...

     

    DELETE A FROM TABLE_NAME A

    WHERE CONVERT(VARCHAR(8),DATEIN,112) < CONVERT(VARCHAR(8),GETDATE(),112)

    DELETE A FROM TABLE_NAME A

    WHERE CONVERT(VARCHAR(8),DATEIN,112) = CONVERT(VARCHAR(8),GETDATE(),112)

    AND CAST(substring(TIMEIN,1,patindex('%:%',TIMEIN)-1) AS INT) < 8

  • RE: How to delete a row if date and time are older than a spacific date and time

    Try this...

     

    DELETE A FROM TABLE_NAME A

    WHERE CONVERT(VARCHAR(8),DATEIN,112) < CONVERT(VARCHAR(8),GETDATE(),112)

    AND CAST(substring(TIMEIN,1,patindex('%:%',TIMEIN)-1) AS INT) < 8

  • RE: How to delete a row if date and time are older than a spacific date and time

    Will this help ?

     

    DELETE A FROM TABLE_NAME A

    WHERE CONVERT(VARCHAR(8),DATEIN,112) < CONVERT(VARCHAR(8),GETDATE(),112)

    AND TIMEIN < 8

  • RE: Duplicate table with the same structure

    select * into duptable from tblstudent where 1=2

  • RE: How to use a single statement ?

    Will this help..?

    SELECT COUNT(cdu_slaok) AS Total , SUM(CASE WHEN cdu_slaok = '1' THEN 1 ELSE 0 END) AS SLA_OK,

    CAST(SUM(CASE WHEN cdu_slaok = '1' THEN 1 ELSE 0 END)AS DECIMAL)*100...

  • RE: T-sql question

    Try the below query...

     

    DECLARE @RFLAG CHAR(1)

    SET @RFLAG = 'D'

    IF @RFLAG = 'D'

     BEGIN

      SELECT COUNT(PRODUCT) NUMPOL, PRODUCT,

      SUM(CAST((ORDER_TOTAL/100.00) AS DECIMAL(12,2))) TXNSALE, AGENTCODE

      FROM TIS_VS

      WHERE (YEAR(TXNDATETIME)=2004 OR YEAR(TXNDATETIME)=2005)

      AND AGENTCODE = '12345'

      GROUP BY PRODUCT, NUMPOL,...

  • RE: Play around the Datetime data

    Hope this helps...

    select Date_and_Time from <table name> where convert(varchar(8),cast(Date_and_Time as smalldatetime),112) >= '20060501'

     

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