Forum Replies Created

Viewing 15 posts - 1,606 through 1,620 (of 3,543 total)

  • RE: Insert into a Linked Server DB

    quotedon't think you can insert rows into a linked server using openquery statement.

    Yes you can

    From LnkSrv1

    INSERT INTO OPENQUERY(LnkSrv2,'SELECT...

  • RE: problem in restoring a new databse .

    As the error states, SQL can only restore from tape backups made using SQL BACKUP, your backup was done using NTBACKUP and hence the error.

    Use NTBACKUP to restore the backup...

  • RE: Grouping, eliminate un-matched pairs?

    Yes, the left join is intentional.

    I used to find if there was a corresponding entry for the previous/following day with the oposite values. So for the data you posted each...

  • RE: Grouping, eliminate un-matched pairs?

    This will work on the data given but any other alternative may not

    SELECT a.pid,a.dos,a.post,DATEDIFF(day,a.dos,a.post) AS [lag],a.part,SUM(a.volume),SUM(a.charges)

    FROM a

    LEFT JOIN b

    ON b.pid=a.pid

      AND b.dos=a.dos

      AND...

  • RE: Question of the Day for 04 Apr 2007

    btw I agree with Hugo, none of the answers is correct.

    I did not answer when I realised this

  • RE: Question of the Day for 04 Apr 2007

    Also used by FTS on incremental catalog population.

  • RE: SQL Query to join a column on a row

    One way

    SELECT c.[id],c.[name],c.[type],v.[value]

    FROM (SELECT [id], 'make' AS [name], [make] AS [value] FROM @veh UNION

    SELECT [id], 'model', [model] FROM @veh UNION

    SELECT [id], 'color', FROM @veh) v

    LEFT...

  • RE: Need help in my Functions

    Why are you using functions to do simple calculations? Or is there more complex query that you have not given?

    You have a logic error in GetItemSoldCount. Whenever you use AND...

  • RE: Getting information from two tables

    SELECT a.costcodeid,a.costcodedesc,b.combistatus

    FROM [coscodetable] a

    LEFT JOIN [tallycombi] b

    ON b.itemid = a.costcodeid

    and b.projectid = '999'

  • RE: select query

    The last line

    ON e.EMPID = x.EMPID and AND l.Verify = 'N'

    has too many AND's and Verify should be referencing alies e not l, ie

    ON e.EMPID = x.EMPID AND

  • RE: select query

    Use a CASE statement

    SELECT x.EMPID,COALESCE(a.[NAME],'') AS [NAME],

    CASE WHEN l.Verify = 'Y' THEN COALESCE(l.LICENSE,'') ELSE '' END AS [LICENSE],COALESCE(l.EMPLSTS,'') AS [EMPLSTS]

    FROM (SELECT @EMPID AS [EMPID]) x

    LEFT JOIN @HREMP_adp...

  • RE: select query

    Not sure what your question is but based on your last query

    a parameter of '11111' will return

    EMPID  NAME  LICENSE  EMPLSTS

    11111  ABC   NULL     NULL

    a parameter of '11112' will return

    EMPID  NAME  LICENSE ...

  • RE: select query

    Replace N'111111' with the parameter, eg @EMPID

    Add any further checks to the ON clause of the License JOIN, eg if the test for not expired is EXPIRED = 0

    then your...

  • RE: select query

    Sorry forgot to remove @ I used table variables to test query

    Should have been

    SELECT x.EMPID,COALESCE(a.[NAME],'') AS [NAME],COALESCE(l.LICENSE,'') AS [LICENSE]

    FROM (SELECT N'111111' AS [EMPID]) x

    LEFT JOIN HREMP_adp a...

  • RE: how can I tell if a colomn exists or not?

    Didn't you mean

    IF NOT EXISTS(select * from information_schema.columns where tablename='programversion' and columnname=@col )

Viewing 15 posts - 1,606 through 1,620 (of 3,543 total)