Forum Replies Created

Viewing 15 posts - 76 through 90 (of 149 total)

  • RE: How stop executing batches in Query Analyzer ??

    That is a terribly silly requirement.

    OK, then how about this:

    IF DB_NAME() = 'Master'

    BEGIN

    PRINT '**************************************************************************************'

    PRINT '************** Master db is selected. Please select correct database *****************'

    PRINT '**************************************************************************************'

    END

    ELSE

    BEGIN

    {do all the...

  • RE: How stop executing batches in Query Analyzer ??

    EDIT: SQLBill trumped me. Sorry for the double post.

    Actually, check out the USE keyword. That tells SQL Server which database to apply the changes to.

    E.g.,

    USE pubs

    SELECT *

    FROM...

  • RE: CAN I SIMPLIFY THE FOLLOWING QUERY

    Assuming that the intent of this query is to create a cross-tab, you pretty much have it.

    Although, if you're using SQL Server 2005, you can look into the PIVOT keyword.

  • RE: Trigger Help Needed

    I don't see anything in that statement involving a subquery. Do you have other code wrapped around it, perhaps error checking code?

  • RE: Compare two tables???

    Er, a much more efficient query (in case performance is an issue) would be:

    SELECT Equip.EquipID, Equip.DivCode

    FROM EquipmentTable Equip

    LEFT JOIN DivisionTable Div

    ON Equip.DivCode = Div.DivCode

    WHERE Div.DivCode IS NULL

    The LEFT JOIN will...

  • RE: Stored Procedure Help

    You'll want a User-Defined Function to concatenate the values.

    CREATE FUNCTION ConcatAccrual (@vEmp int)

    RETURNS varchar(500)

    AS

    BEGIN

    DECLARE @myString varchar(500)

    SET @myString = ''

    SELECT @myString = @myString + EmpTable.Accrual + ' '

    FROM EmpTable

    WHERE EmpTable.EmpNo...

  • RE: Concatenating in select statement?

    We should probably look into creating a sticky post with a FAQ. This question, in particular, seems to come up two or three times a week.

    CREATE FUNCTION ConcatID (@vName...

  • RE: Is there a better way?

    Depending on the amount and type of reporting you are doing, storing the Duration as a computed column may be beneficial to you. It has some cost to it,...

  • RE: Trigger Help Needed

    You need to specify your table. E.g.,

    UPDATE myTable

    SET sent = 1

    ...

  • RE: Query for Email Attachments

    The problem is that your SELECT statement is replacing the value of @@AttachMe with each row.

    Try this instead (replacing the semicolon with whatever character should separate one filename from the...

  • RE: Reading XML file from web

    Check out OPENXML in Books Online, and the related topics. There's actually quite a bit of useful info in there about how to import XML files.

  • RE: long Date Problem - insert and search between tow dates

    That would depend, in some part, in how exactly you are passing those values into your query. Are you building the query on the fly in ASP? Is...

  • RE: long Date Problem - insert and search between tow dates

    The first is mostly correct, but you still have a couple less than comparisons with zeroes in there.

    SELECT * FROM SilokE WHERE ((SilokE.mhlka) Like ('3'))

    AND (((SilokE.id) Not In

    (select id...

  • RE: long Date Problem - insert and search between tow dates

    This is very similar to the classic problem of only searching by the day, and losing the last day from the results.

    I'm willing to bet that these datetime values are...

  • RE: INSERT INTO error

    Is one of the fields in your query there the identity field? If so, that won't work unless you have the IDENTITY INSERT set to ON.

    If it's not, then...

Viewing 15 posts - 76 through 90 (of 149 total)