Forum Replies Created

Viewing 15 posts - 121 through 135 (of 161 total)

  • RE: Precise timing

    If you cannot get the small time increments that you are looking for by simply using datepart(ms, @timer, getdate()) then why not loop around your code say 100...

  • RE: Should you index a Primary Key?

    Correct, adding a Primary Key to a table also adds and Index to that table.

    However, when you add a Foreign Key constraint it will not automatically add an index for...

  • RE: Calling UDFs with Date Parameters

    BillyWilly, if you are looking for a solution to your problem then Greg gave the solution in his first post.

    If you are looking to just bitch about the TSQL language,...

  • RE: SQL Traces

    With regard to your question about the Insert trigger...

    The trigger will fire before the Insert is committed since it is permissable to rollback the insert operation should the inserted record(s)...

  • RE: Generic SP or UDF for Translation

    Since you are looking to return 2 values, I would suggest the use of an SP with 2 OUTPUT params rather than a UDF.

  • RE: Does anyone know how to do this

    If your data is still held in Access2000, then you could create a Query in Access then output it direct to Excel. (There is an export to Excel command in...

  • RE: Left Outer Join w/ Not In criteria = Inner Join

    In order to prevent SQL from changing this to an INNER JOIN you need to specify the criteria in the JOIN and not the WHERE clause.

    Try this.....

    select a.*

    from table_1 a

    left...

  • RE: Data Pivot Problem

    It is possible to pivot data using the case statement.

    If the columns are known, you can use this.

    select shopid,

    sum(case receiptcode

    when 1 then amount

    else 0

    end) as receipt1,

    sum(case receiptcode

    when 2 then amount

    else...

  • RE: JOINing tables with different number of rows

    ....sorry, had to edit comment above to LEFT join instead of INNER join.

  • RE: JOINing tables with different number of rows

    Try this

    select s.memID, s.Gender, s.Age,

    case when o.memID is null then 0 else 1 end as Online

    from memSearch s left join memOnline o on s.memID = o.memID

    Edited by - paulhumphris...

  • RE: - Syntax Question

    The CHARINDEX method is also being performed on every row of your table and is unable to make use of any indexes since it is non-SARGable. (i.e. calculated)

    If you didn't...

  • RE: - Syntax Question

    BKelly's suggestion (in the other parallel forum) of using the following...

    SELECT FullName

    FROM Users

    WHERE CHARINDEX(fname, @Param1) > 0

    ...is flawed in that if 'john' is in the search @Param, the results will...

  • RE: - Syntax Question

    In addition to my reply above you may also need to ensure that you have apostrophe's around the text values in your @Param1 variable.

    Something like this should do it....

    SET @Param1...

  • RE: - Syntax Question

    Try using dynamic SQL.....

    ALTER PROCEDURE dbo.StoredProcedure1

    @param1 varchar (1400)

    AS

    DECLARE @sql varchar(8000)

    SET @Param1 = 'joe,john,jay'

    -- if using pipe delimiters include a replace statement

    SET @Param1 =...

Viewing 15 posts - 121 through 135 (of 161 total)