Forum Replies Created

Viewing 15 posts - 31 through 45 (of 51 total)

  • RE: Too many output returns?

    hey francisco,

    can you please clarify the problem ...

    what do you mean by "when the sproc ends it spits out both the @MyID (which I don't want...

  • RE: Crosstab -- eliminate rows with all zeroes

    hey joe,

    you are almost there ... to get rid of rows with any zeroes your query would have to be a subquery ...

    so, the final SQL would...

  • RE: How To Return Results from EXEC of Dynamic SQL

    hi jim,

    i updated the code in my previous post to do the CAST operation using sp_executesql.  Refer to the post that has the CREATE PROCEDURE statement ...

    JP

  • RE: How To Return Results from EXEC of Dynamic SQL

    hey jim,

    i think this should do the trick:

    CREATE PROCEDURE dbo.usp_dyna_cast(@ReturnValue sql_variant OUTPUT)

    AS

    BEGIN

      SET NOCOUNT ON

      DECLARE @DisplayValue AS VARCHAR(255), @ItemType AS VARCHAR(255)

      SELECT @DisplayValue...

  • RE: How To Return Results from EXEC of Dynamic SQL

    hey, try this to see if that is what you are looking for:

    CREATE FUNCTION dbo.fn_dyna_cast() RETURNS sql_variant

    AS

    BEGIN

      SET NOCOUNT ON

      DECLARE @DisplayValue AS VARCHAR(255), @ItemType AS VARCHAR(255)

     ...

  • RE: Variable not allowed in select statement for tablename

    hey,

    SQL Server does not allow variables for table names in the FROM clause, except for table variables.

    Try to do the queries without relying in a dynamic table...

  • RE: Queries Slowed by New Column

    Have you tried updating the statistics and recompiling the database object (i.e: view, stored proc, etc.) in which the query resides to see if that improves performance? 

    I'm thinking...

  • RE: How can I do this in SQL?

    Hey, just a heads up ... I modified the T-SQL code in my previous post (i.e. the post that creates the fn_get_measure(..) function) based on rockmoose's recommendation to convert...

  • RE: xp_sendmail question

    One approach I originally thought about was a straightforward queued approached to sending e-mails:

    1) Whenever a document is inserted or updated in the EDMS database, have the corresponding...

  • RE: xp_sendmail question

    hey R B

    try one of the following:

    (1) Add an emailID to the workgroup_user table which is the mailing list e-mail address containing the email addresses of all...

  • RE: Table Variables How and When???

    hey cedar, try this link:

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_tsqlcon_6lyk.asp

    for your your case, you would first need to declare a table variable say like this:

    DECLARE @tempTable TABLE (

     ...

  • RE: Find missing Date

    hey, try this to see if that is what you are looking for:

    SELECT

      startdate_from = t1.startdate,

      enddate_from = t1.enddate,

      startdate_to = t2.startdate,

      enddate_to = t2.enddate,

      potential_error_id =...

  • RE: How can I do this in SQL?

    hey,

    i think you are looking for something like this:

    -- [BEGIN CODE]

    CREATE FUNCTION dbo.fn_to_inches(@feet AS INTEGER, @inches AS INTEGER) RETURNS INTEGER

    AS

    BEGIN

      DECLARE @result AS INTEGER

     ...

  • RE: CASE With a Calculated Value

    hey scking,

    jt-75 is right ...

    here is the query that jt-75 is talking about:

    SELECT

      Calculated_Value =

        CASE

          WHEN MonthsOfStock < 1 THEN 10

          WHEN MonthsOfStock >=...

  • RE: Query Help

    hey,

    i think this is what you are looking for:

    SELECT

      e.EmpId,

      PhNo = '' + CASE WHEN e.PhNo IS NOT NULL THEN e.PhNo + ',' ELSE '' END

    FROM

      T1...

Viewing 15 posts - 31 through 45 (of 51 total)