Forum Replies Created

Viewing 15 posts - 61 through 75 (of 206 total)

  • RE: Batch Variable in sqlcmd

    bommaka.nagarjun (9/23/2009)


    Hi ,

    I am writing a batch script which will take Full backup of the specified databases on our server. For this i am first creating...

  • RE: Local Variable Question

    Yet another syntax problem I missed. Change the @sql datatype to NVARCHAR(1000).

    I think that will fix your problem.

    rjv_rnjn is correct also. I went down a more...

  • RE: Local Variable Question

    Sorry, it should look like this:

    execute sp_executesql @sql

  • RE: Local Variable Question

    You can't "select * from" a varchar variable but you can do something like this. The syntax might be incorrect. I can't test right now but you can...

  • RE: Coalesce returning 1 value only

    Lynn's right having the table structures and sample data does make helping out a lot easier. But I think I understand the problem at least well enough to throw...

  • RE: Coalesce returning 1 value only

    The problem is that a count of 0 is still nonnull so that is what coalesce returns. You could probably do something with a case statement that would correct...

  • RE: Coalesce returning 1 value only

    From BOL: COALESCE Returns the first nonnull expression among its arguments.

    So in your case the first argument will always be nonnull so it will be the one returned.

  • RE: I need to get a list of tables in a database

    I think this will work for you

    SELECT * FROM sys.sysobjects S

    WHERE type = 'U'

    AND name LIKE 'GEN%'

  • RE: xp_cmdshell login permissions

    Just to expand a little. The issue is that whatever account runs xp_cmdShell needs to have permissions on the server since this stored procedure basically just gives you a...

  • RE: Concatenating a column to a variable

    The execution plans are quite different but I am not an expert at reading these so I will leave that for someone else.

    1 does a merge join (concatenation)...

  • RE: Set Date - @BeginDate

    This should work but I don't have a SQL 7 or 2000 instance to test on.

    DECLARE @BeginDate DATETIME

    DECLARE @EndDate DATETIME

    SELECT @BeginDate = DATEADD(YEAR,DATEDIFF(YEAR,0,GETDATE()),0)

    SELECT @BeginDate

  • RE: BETWEEN in SQL Variables

    As GSquared said:

    you can use the variables you already have

    select sum(revenue) from table1

    where revenueDate between @dMonthStartDate and @MonthEndDate

  • RE: Selecting Dates Within A Date Range

    The datetime datatype will use midnight as the time if none is specified. So you really do want the dates between 03/19 and 03/20

  • RE: BETWEEN in SQL Variables

    What are you trying to accomplish?

  • RE: A very tricky query--please help

    I think this will work but it would help if you posted the DDL for these tables and some insert statements.

    select firstName, lastName

    from table_1

    where id in (select supervisor from table_2...

Viewing 15 posts - 61 through 75 (of 206 total)