Forum Replies Created

Viewing 15 posts - 10,936 through 10,950 (of 15,376 total)

  • RE: Create view with no outer joins

    jdbrown239 (8/26/2012)


    Need to create view with no outer joins so I can index the view. Here is the query I use to create the view. Does anyone no of a...

  • RE: Check room availability in hotel system

    mfundotogu (8/26/2012)


    create table Rooms

    (Room_no char(4) primary key not null,

    Room_Status varchar(20) not null,

    Room_Type_Code char(4) foreign key references Room_Type(Room_Type_Code))

    go

    Data in the Table.

    1011AvailSTD1

    1012AvailSTD1

    2011AvailDLX2

    Create table Room_Bookings

    (Booking_ID char(8) NOT NULL ,

    Room_no char(4) NOT NULL Foreign...

  • RE: Join making conflict....

    Saga... (8/27/2012)


    SELECT @MSGOUT = @MSGOUT + '

    <tr>

    <td>' + ss.ServerName +'</td>

    <td>' + ss.DBName +'</td>

    <td>' + Occurrences +'</td>

    </tr>

    '

    FROM /*DBINVENTORY ss --after removing this...

  • RE: transaction cannot be committed

    Try this instead then:

    if EXISTS

    (

    select * from sys.columns

    where object_id = object_id('TableA')

    and is_identity = 1

    )

    SET IDENTITY_INSERT TableA ON

    LOL or use Lynn's. His is probably a little better way to check for...

  • RE: transaction cannot be committed

    haiao2000 (8/24/2012)


    Thank you for quick response. I actually replied to my post previously. you are right all i tried to do on that is basically squelching, definitely not handling. I...

  • RE: transaction cannot be committed

    Here is proof. In my database I do not have TableA.

    DECLARE @ErrorMum INT

    DECLARE @ErrorMessage VARCHAR(200)

    DECLARE @Severity INT

    DECLARE @State INT

    BEGIN TRY

    BEGIN TRAN BACKUP101

    BEGIN TRY

    SET IDENTITY_INSERT TableA ON

    END...

  • RE: transaction cannot be committed

    My guess is one your early try-catch blocks has encountered an error but you can't tell because you have empty catch blocks. I call that error squelching, not handling. The...

  • RE: Using CASE to execute one of two SQL statements

    stephen mehl (8/24/2012)


    I spoke too soon.

    I need multiple uses ... SQL does not like the second instance of "IF"

    IF EXISTS (..)

    summarize the data - 1

    ELSE

    add a...

  • RE: how to remove zero from my string

    For anybody else still following along I put together a test harness to check this out. Thanks to Jeff for the sample data.

    CREATE FUNCTION RemoveLeftCharPatIndex

    (

    @Source VARCHAR(1000)

    ...

  • RE: how to remove zero from my string

    tyson.price (8/24/2012)


    I get your point but, that is why we have comments. I will take performance over easy to read any day of the week. Comments are easy to type...

  • RE: how to remove zero from my string

    tyson.price (8/24/2012)


    Eugene Elutin (8/24/2012)


    Steven Willis (8/24/2012)


    Try this:

    CREATE FUNCTION dbo.svfRemoveLeftMostCharacters

    (

    @Source VARCHAR(1000)

    ,@Char CHAR(1)

    )

    RETURNS VARCHAR(1000)

    AS

    BEGIN

    /* This function requires a Tally or Numbers table */

    /* http://www.sqlservercentral.com/articles/T-SQL/62867/...

  • RE: Design pattern for Phone

    I tend to agree with Lowell on this one though. A phone number is rather meaningless by itself. It only gains relevance when you know what it belongs to. I...

  • RE: How to check more then one row for null by a value passed in

    and CO.OrderID in (Select OrderID from OrderHandsets(nolock) where ConDate is not null or ConDate <> '') --This is where i need to check each row

    You should change this to...

  • RE: Nested Loops Joins

    And no amount of testing can ensure that using join hints will be correct. What is better on the data today may very well be different tomorrow when the amount...

  • RE: Make result editable in select statement

    adonetok (8/24/2012)


    Thank you for help.

    I did the way you are showing but it is not convenient.

    Every time I need to modify it.

    Well SSMS is not designed to be a data...

Viewing 15 posts - 10,936 through 10,950 (of 15,376 total)