Forum Replies Created

Viewing 15 posts - 26,431 through 26,445 (of 26,484 total)

  • RE: return value help..

    You have it at the end of your procedure, it just isn't coded right.

    You have:

    --if (@ogt_code = 'Golf Course' and @ret_value >1) --I added this to try to fix

        --select...

  • RE: return value help..

    Shouldn't the select in the if statement look like this:

    select @ret_value = @ret_vale + 1

    I would prefer to use a set statement where you are using select to set @ret_value:

    set...

  • RE: Stored procedure with up to 1000 parameters

    If you are looking at dynamic sql and accessing variable, look at using the extend stored procedure sp_executesql.  You can find information about that procedure in BOL and I believe...

  • RE: Restoring transactional backups on a different server with a different database name

    Here is how I do it for one of our databases:

    RESTORE DATABASE [H88TRN]  -- Restore of full backup

    FROM  DISK = N'F:\sql_backups\H88PRD\H88PRD_20060804.bak'

    WITH  FILE = 1,

          MOVE N'H88PRD_data' TO N'F:\sql_DBs\User_DBs\H88TRN\H88TRN_Data.mdf',

          MOVE N'H88PRD_log' ...

  • RE: Upgrading SQL Server 2005 to SP 1

    I have a default instance of SQL 2000 and a named instance of SQL 2005 on my box as well.  I have no problem selecting the named instance of SQL...

  • RE: copy only structure from table A to table B

    Another way:

    select * into TableB from TableA where 1 = 2

    Be sure TableB does not exist.  Also this will not copy indexes, constraints, etc.

     

  • RE: Need a suggestion and solution

    If it is running 6 minutes, you may still want to do some more work.  I would suggest looking at your current indexes and perhaps running SQL Profiler to see...

  • RE: Stored procedure help needed.. BADLY

    Actually, I've used this to do some Test-Driven Development in SQL Server.  It has all been manual at this time, but it's let me capture updates without destroying the underlying...

  • RE: Problem with LEFT JOIN

    I stand corrected on stax68's code.  My misperception was on where the criteria select was being completed.  I have done some testing and I am posting those results here for...

  • RE: Problem with LEFT JOIN

    After wrestling with it some more, I have come up with a viable solution using a derived table and

    a cross join.  Please take a close look at the query to...

  • RE: Problem with LEFT JOIN

    I have made some updates to my test code:

    set nocount on

    create table dbo.SchoolAttendance(

        AttendanceRuID int,

        StudentID int,

        AttendanceDate datetime,

        AttendanceTyID int,

        RollupCount int,

        termID int null

    )

    create table dbo.SchoolAttendanceTy (

        AttendanceTyID...

  • RE: Problem with LEFT JOIN

    Actually, not.  In your code, you have hardcoded the student id.

    your code:

    select sat.AttendanceTyID

    , sat.Description

    , sar.AttendanceRuID

    , 169 StudentID

    , sar.AttendanceDate

    , isnull(sar.RollupCount,0) RollupCount

    from SchoolAttendanceTy sat

    left join...

  • RE: Problem with LEFT JOIN

    Here is an update of what I have done:

    set nocount on

    create table dbo.SchoolAttendance(

        AttendanceRuID int,

        StudentID int,

        AttendanceDate datetime,

        AttendanceTyID int,

        RollupCount int,

        termID int null

    )

    create table dbo.SchoolAttendanceTy (

        AttendanceTyID...

  • RE: Problem with LEFT JOIN

    I'm sorry, but I don't see how your code solves the problem.  You still have a condition in the where clause checking for StudentID = 169.  The table SchoolAttendanceTy does...

  • RE: Problem with LEFT JOIN

    stax68,

    Everything I used is in my big post.  Add where sa.StudentID = 169 to the where clause and you will reduce the result set displayed in my post by 1...

Viewing 15 posts - 26,431 through 26,445 (of 26,484 total)