Forum Replies Created

Viewing 15 posts - 1,141 through 1,155 (of 6,036 total)

  • RE: how to convert navarchar to datetime

    komal145 (9/22/2016)


    @luis:Thank you for reply . I tried your query and the result from your query is :Aug 10 2016 5:29AM .

    Which is not what i want. I...

  • RE: How do I initialise a sql variable to 0 in stored-procedure ?

    To illustrate my point I make a little amedment to the piece of code from Luis:

    DECLARE @N int = 0;

    WHILE @N < 5

    BEGIN

    DECLARE @What int =...

  • RE: How do I initialise a sql variable to 0 in stored-procedure ?

    Smendle (9/22/2016)


    Eirikur Eiriksson (9/22/2016)


    For a variable inside the procedure use this

    😎

    DECLARE @MY_INT_VAR INT;

    SET @MY_INT_VAR = 0;

    i could be confusing this with a .NET programming environment but doesn't that initialize the...

  • RE: Is there a better faster way then REPLACE in this example?

    ghughes (9/22/2016)


    I just need to produce "Needs Model Review" if I can't get a match. I am joining the 2 tables that have some matching criteria and both...

  • RE: Is there a better faster way then REPLACE in this example?

    gvoshol 73146 (9/22/2016)


    I like Sergiy's solution too. But what happens when you need to insert a new replacement code between priority 3 and 4?

    Increase priority value in all rows...

  • RE: how to convert navarchar to datetime

    Be aware that conversion of varchars to datetimes by style "120" is locale dependent.

    On different server settings you may get different results:

    SET DATEFORMAT DMY

    SELECT CONVERT(VARCHAR(20), CONVERT(datetime,CAST('2016-08-10 05:29:27' as datetime),112), 100)...

  • RE: Is there a better faster way then REPLACE in this example?

    ghughes (9/21/2016)


    this is what I can do. I can write some sql, that will produce some tsql alter statement to a function that is driven by the bad...

  • RE: Stored Proc, Output new id if null

    The call for @SaleID as OUTPUT parameter (consider @newSaleId removed):

    DECLARE @SaleID UNIQUEIDENTIFIER

    EXECUTE AddUpdateSale @SaleId OUTPUT,1, 1, 1

    PRINT 'SaleID: ' + CAST(@SaleID as nvarchar(50))

    GO

  • RE: Stored Proc, Output new id if null

    First, there must be a mistake in WHERE clause of UPDATE statement.

    See if my correction is OK.

    Second,

    SELECT TOP 1 with no ORDER BY will return random results.

    Don't use it...

  • RE: Space Availability on a network share

    CREATE TABLE #Output (

    RowNo INT IDENTITY(1,1) PRIMARY KEY,

    output NVARCHAR(4000)

    )

    INSERT #Output ( output )

    EXEC MASTER..xp_cmdshell 'dir \\ServerName\SharedFolder'

    SELECT *

    FROM #Output o

    WHERE Output LIKE '%bytes free%'

  • RE: How to read list of files in folder using T-SQL?

    BOR15K (9/20/2016)


    Hello,

    Can one advise how to obtain file's details, please? Both xp_dirtree and xp_cmdshell return expected list of files, but I also need their properties: size and date.

    Is it possible,...

  • RE: View for real-time list pulls in an OLTP

    vilyana (9/19/2016)


    Thank you for the concern.

    The ERD and the View columns in the image are exactly what they need to be to illustrate the starting point and desired result...

  • RE: Updating column in SQL

    les.61 (9/19/2016)


    Many thanks Sergiy

    If I run the SET command I get an "incorrect Syntax near '=' " message.

    I ran

    Select (City + ' - ' + [Zip-Code] + '...

  • RE: Updating column in SQL

    Sergiy (9/19/2016)


    les.61 (9/19/2016)


    Koen

    Sorry forgot to say the Description column also has additional data after the City so cannot just bring in the City and Zip-code from another table. Need to...

  • RE: Updating column in SQL

    les.61 (9/19/2016)


    Koen

    Sorry forgot to say the Description column also has additional data after the City so cannot just bring in the City and Zip-code from another table. Need to use...

Viewing 15 posts - 1,141 through 1,155 (of 6,036 total)