Forum Replies Created

Viewing 15 posts - 2,146 through 2,160 (of 3,544 total)

  • RE: Must Declare Variable error....

    oooops! forgot to initialise the variable

    need to add

    SET @count = 0

    before sp_executesql

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Must Declare Variable error....

    or

    SET @strQuery = 'IF EXISTS(select 1 from app_client where ' + @conditionstring + ') SET @count=1'

    to avoid using count(*) to improve performance

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Must Declare Variable error....

    Create Procedure XYZ

    (

    @conditionstring   nvarchar(3950)

    )

    AS

    DECLARE @count int

    DECLARE @strQuery nvarchar(4000)

    SET @strQuery = 'Select @count = count(*) from app_client where ' + @conditionstring 

    EXEC sp_executesql @strQuery, N'@count int OUTPUT', @count...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Must Declare Variable error....

    sushila

    SELECT *

    Bad practice

    I would do

    IF NOT EXISTS(SELECT 1 FROM app_client WHERE first_name = @name AND last_name...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Select nth highest marks

    SELECT a.DeptId, MIN(a.Marks) AS [Marks]

    FROM a

    WHERE a.Marks IN

    (SELECT TOP 2 b.Marks FROM b WHERE b.DeptId = a.DeptId ORDER BY Marks DESC)

    GROUP BY a.DeptId

    ORDER...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Create procedure to delete records and reset identity column.

    Create the procedure to do the following

    DELETE FROM WHERE ....

    DECLARE @newseed int,@sql nvarchar(100)

    SELECT @newseed=ISNULL(MAX([ID]),0) FROM

    SET @sql = N'DBCC CHECKIDENT (,RESEED,' + CAST(@newseed as nvarchar) +...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Checking for a file''''s footer

    SqlJunkie beat me to the punch

    As an alternative why not load the data into a staging table (with rowid IDENTITY column) then...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Finding position in a string

    quote...is that the voice of a sore loser...

    Who me  Never

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Finding position in a string

    quoteha David - another one for remi! Not that anyone's keeping tabs!!!

    Yeah as always

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Finding position in a string

    and.......

    if the number of digits following BAL is variable then

    select substring(@string, charindex('bal', @string), patindex('%[a-z]%',substring(@string, charindex('bal', @string)+4, len(@string)))+3)

    as for the rest of the parsing we will need for accurate definition of...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: GUID conversion

    http://www.databasejournal.com/features/mssql/article.php/3500276

    This reports on long running jobs but it will give you what you are looking for

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Automatically Create Joints

    This query

    SELECT x.shopID,ISNULL(st.stateID,-1) AS [stateID],x.stateName

    FROM (SELECT sh.shopID,

    SUBSTRING(',' + sh.states + ',', n.number + 1,

    CHARINDEX(',', ',' + sh.states + ',', n.number + 1) - n.number - 1) as...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: how do i build this query?

    Two observations

    Your last posted query uses a column named [RIC] which is not specified elsewhere and therefore the query will not work

    The query uses an INNER JOIN which means you...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Question on stored procedure

    Maybe  Definately indeterminate

    RETURN expects an 'integer expression', the subquery is not and neither is it's results.

    Mind you,...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: creating triggers for temporal databases

    1. Your code indicates that PAY_DURING and EMPLOYED_DURING records exist before the EMPLOYEE record

    2. Write a sp to insert EMPLOYEE and do the checks there

    3. If sp not possible and...

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 15 posts - 2,146 through 2,160 (of 3,544 total)