Forum Replies Created

Viewing 15 posts - 886 through 900 (of 2,007 total)

  • RE: Mulitple Saarch Criteria using ONE Column

    Cadavre (2/14/2012)


    (I'm not claiming it isn't worse than yours, just that I don't really see how - will have to do a nice big test set-up when I have time...

  • RE: Mulitple Saarch Criteria using ONE Column

    Jeff Moden (2/14/2012)


    Cadavre (2/14/2012)


    Am I missing something?

    SELECT Code, Name, City

    FROM (SELECT *, ROW_NUMBER() OVER(PARTITION BY City ORDER BY Code) AS rn

    FROM #MyHead

    ...

  • RE: International Database Administrator Job

    kapfundestanley (2/14/2012)


    Hello colleagues,

    I have more than 3 years working with SQL and would like your assistance in securing an international SQL DBA job.I would definitely appreciate your assistance.

    Are you hoping...

  • RE: Order by While inserting

    Koen Verbeeck (2/14/2012)


    Cadavre (2/14/2012)


    Look at his "ID" column. You'll see that he essentially wanted to order that by the "Name", rather than using what was already stored in [Temp#1].

    Well,...

  • RE: Logon trigger malfunctions

    That's slightly strange.

    The below is using the same logic as your code, so can't see that it would work any better.

    DECLARE @sql NVARCHAR(MAX)

    IF (SELECT COUNT(*)

    FROM sys.dm_exec_sessions

    ...

  • RE: Order by While inserting

    John Mitchell-245523 (2/14/2012)


    SELECT * FROM #temp2

    ORDER BY ID

    John

    John Mitchell-245523 (2/14/2012)


    No they shouldn't. A table is an unordered set. The database engine will retrieve rows from a table in...

  • RE: Order by While inserting

    BEGIN TRAN

    --Your sample data

    CREATE TABLE [Temp#1] (ID INT, Two INT, Name VARCHAR(6));

    INSERT INTO [Temp#1]

    SELECT 1, 1, 'XXABCD'

    UNION ALL SELECT 2, 2, 'BCA'

    UNION ALL SELECT 3, 4, 'ABCD'

    UNION ALL SELECT 4,...

  • RE: Mulitple Saarch Criteria using ONE Column

    Am I missing something?

    SELECT Code, Name, City

    FROM (SELECT *, ROW_NUMBER() OVER(PARTITION BY City ORDER BY Code) AS rn

    FROM #MyHead

    ...

  • RE: How to query based on a specific time range...

    Vincy-856784 (2/13/2012)


    Thank you Cadavre for your quick response. But this returns zero rows. Also, I cannot hardcode values and it should be dynamic based on the user selected...

  • RE: Old Dog, New Tricks

    Jeff Moden (2/13/2012)


    Heh... there are a lot of tried and true methods available in SQL Server that seem to be going by the wayside in favor of "slick" stuff. ...

  • RE: How to query based on a specific time range...

    SELECT *

    FROM Log

    WHERE ActionTimeStamp >= '2012-10-02 07:30:00' AND ActionTimeStamp <= '2012-10-02 08:30:00'

  • RE: Is there any way to set a @variable to IS NULL?

    memymasta (2/13/2012)


    Hmm not really.

    I got this query..

    Select a.a from a LEFT JOIN b ON a.a=b.b WHERE b.b IS NULL

    Is it possible to get same results with

    Select a.a from a LEFT...

  • RE: Dynamically create SQL statement

    DECLARE @Fields AS VARCHAR(4000)

    DECLARE @ClientName AS VARCHAR(100)

    DECLARE @AuditYear AS VARCHAR(50)

    SET @Fields = 'Audit Number,Audit Year,Client Name,status'

    SET @ClientName = '''AAFES'''

    SET @AuditYear = '''2010'''

    DECLARE @SQLstmt NVARCHAR(MAX)

    --Do the dynamic bit

    SELECT @SQLstmt = COALESCE(@SQLstmt,...

  • RE: Dynamically create SQL statement

    Something like this should do: -

    DECLARE @Fields AS VARCHAR(4000)

    SET @Fields = 'Audit Number,Audit Year,Client Name,status'

    DECLARE @SQLstmt NVARCHAR(MAX)

    --Do the dynamic bit

    SELECT @SQLstmt = COALESCE(@SQLstmt, '') + ',' + CHAR(13) + CHAR(10)...

  • RE: Application error

    vijay82 (2/10/2012)


    User can not connect with below error.Can any one help me.

    The connection statement looks like this:

    conn.open "Provider=SQLNCLI10; Data Source='xxxxxx';Initial Catalog='yyyyyyyy';User Id=sssss ...

Viewing 15 posts - 886 through 900 (of 2,007 total)