Forum Replies Created

Viewing 15 posts - 1,741 through 1,755 (of 3,544 total)

  • RE: Return all rows for todays date, and yesterday.

    Just semantics but how can yesterday be from last month

    Two possible interpretations I can see from your request

    1.

    DECLARE @today datetime, @yesterday datetime

    SET...

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

  • RE: Preventing doubling up of database

    1. Put a constraint on the table to produce error for duplicates

    2. Change the INSERT statement to only insert rows not already present

        (use LEFT OUTER JOIN)

     

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

  • RE: Executing updates in Batches

    Use @@ROWCOUNT, something like this

    SET ROWCOUNT 100

    DECLARE @rowcount int

    SET @rowcount = 1

    WHILE @rowcount > 0

    BEGIN

    UPDATE test_bulk_update

    SET updated = 'Y'

    WHERE updated IS NULL...

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

  • RE: How to store ExecuteScalar value into a variable?

    Are you ignoring trapped errors?

    e.g. no permission to table

    If command fails, ExecuteScalar will return nothing and CInt will convert it to zero.

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

  • RE: Syntax error converting datetime from character string

    What are you trying to achieve

    SELECT DATEADD(dd,1,GETDATE())

    or

    SELECT 'DATEADD(dd,1,'''+ CAST(GETDATE() as char(11)) + ''')'

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

  • RE: dbo.sp_EstTableSize script

    Does your table name contain spaces?

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

  • RE: is the sql server being smart or stupid?

    http://support.microsoft.com/kb/q298674/

    will give you your answer

     

    Edit:

    p.s. I always use fully-qualified column names in my subqueries

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

  • RE: Pass a value to a trigger...

    quoteDavid stole my thunder (great minds think alike)

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

  • RE: Unique Usernames

    Try this

    DECLARE @LastName varchar(20)

    DECLARE @FirstName varchar(20)

    SET @LastName = 'Smith'

    SET @FirstName = 'Jo'

    CREATE TABLE #temp ([ID] int IDENTITY(1,1), Username varchar(40))

    INSERT INTO #temp (UserName)

    SELECT l.LastName+f.FirstName

    FROM (SELECT n.Number,LEFT(@LastName,n.Number) AS [LastName]...

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

  • RE: dynamic sql

    quoteYou cannot use #temp in dynamic SQL

    Yes you can

    Provided it is...

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

  • RE: Pass a value to a trigger...

    Notwithstanding what has already been said

    Top of the head answer

    Create a permanent table consisting of SPID and Username

    In SP

    Insert @@SPID and Username into...

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

  • RE: Generic Audit Trigger

    quote...the Deleted table is empty for Deletes...

    Oh not it's not

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

  • RE: How to turn null result to zero?

    quote...CASE Count(*) WHEN 0 THEN 0 ELSE 1 END AS CountStore...

    Or

    SIGN(COUNT(*)) AS [CountStore] 

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

  • RE: T-SQL start: command

    It is not a command it is a label for use with GOTO, eg

    start:

    PRINT 'Looping'

    GOTO start

     

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

  • RE: Ignore DTS tbale mport errors

    quoteWhat is "transform data task"

    It is the task within a DTS package that transforms data between the Source...

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

Viewing 15 posts - 1,741 through 1,755 (of 3,544 total)