Forum Replies Created

Viewing 15 posts - 751 through 765 (of 1,491 total)

  • RE: Log Shipping with Reindexing Jobs

    Re-indexing is a bulk logged operation.

    If you will never need to restore to a point in time while re-indexing is happening try:

    1. Switch to bulk logged.

    2. Reindex

    3. Switch to Full.

    The...

  • RE: Restrict access to instance

    You could try disabling remote connections first.

  • RE: a problem with sql 2008 statemets

    SET ANSI_NULLS, QUOTED_IDENTIFIER ON

    GO

    ALTER PROCEDURE dbo.Insert_Login_Role

    @Login_Name nvarchar(50),

    @First_Name nvarchar(50),

    @Last_name nvarchar(50),

    @user_Password nvarchar(50),

    --@Login_date date,

    @Gender nchar(10),

    --@Birth_year date,

    @Role_Name nvarchar(50)

    -- @Role_ID int

    --@Role_ID2 int

    AS

    SET NOCOUNT ON

    INSERT INTO [Login] (Login_Name, First_Name, Last_name, user_Password, Login_date, Gender, Birth_year)

    OUTPUT @Role_Name, inserted.Role_ID...

  • RE: Trigger error

    Change the text columns to varchar(MAX)

  • RE: Query help for 'not in'

    A NOT EXISTS sub-query will also do as you want:

    ;WITH CheckTable (Cid)

    AS

    (

    SELECT @param1

    UNION ALL SELECT @param2

    UNION ALL SELECT @param3

    UNION ALL SELECT @param3

    )

    UPDATE [Table]

    SET deleted = 1

    WHERE id = @id

    AND seq...

  • RE: Complex Query

    BeginnerBug (3/9/2011)


    create table #sample(sno int identity,student_no int, head int,task varchar(50))

    insert into #sample (student_no,head,task) values(1,10,'tactical')

    insert into #sample (student_no,head,task) values(10,20,'basket')

    insert into #sample (student_no,head,task) values(20,40,'aerospace')

    insert into #sample (student_no,head,task) values(40,10,'robot')

    insert into #sample (student_no,head,task) values(10,40,'tackle')

    insert...

  • RE: Smart Query Writing

    An index on Col1, Col2, Col3, Col4, Col5, Col6, Col7 would help.

    The following syntax may be more efficient:

    ;WITH MaxCol

    AS

    (

    SELECT Col1, Col2, Col3, Col4, Col5, Col6, Col7, Col8

    ,MAX(Col7) OVER (PARTITION BY...

  • RE: Query to return related data based on column value in original query

    If possible, redesign the schema.

    With your current schema, you can UNION ALL queries with SourceType = 1 and SourceType = 2.

  • RE: Update a Column that Exists in Any Table

    The problem is more complicated if you have multiple levels of foreign keys.

    Also the foreign keys may not have the same column names as the referenced column.

    The following uses recursion...

  • RE: Import File to Table without changing the order

    To confirm what has already been said, a relation (table view etc) is an unordered set.

    If you are importing data from a text file, and the original order is important,...

  • RE: Primary Key based on Function

    I think it would be best to incorporate the logic of the function into the INSERT statement especially as access to myTable will need to be SERIALIZED.

    This could be done...

  • RE: Help writing a SQL - to capture counts

    Then use a case statement inside the SUM to return 1 or 0 depending a whether the condition is met.

  • RE: Help writing a SQL - to capture counts

    SELECT SUM(1 & IND1) AS IND1

    ,SUM(1 & IND1 & IND2) AS IND2

    ,SUM(1 & IND1 & IND2 & IND3) AS IND3

    -- etc

    FROM ALL_INDS

  • RE: Flawed Trigger in SQL 2005

    There could be both inserts and updates:

    SET ANSI_NULLS, QUOTED_IDENTIFIER ON

    GO

    ALTER TRIGGER [dbo].[Update2ndTable]

    ON [dbo].[Table1]

    AFTER INSERT, UPDATE

    AS

    SET NOCOUNT ON

    UPDATE T2

    SET EmailAddr = I.EmailAddr

    ,Folder = RTRIM(UploadPath) + '\' + RTRIM(UserName)+ '\Downloads'

    FROM [dbo].[Table2]...

  • RE: Update statement returns different results each time it runs

    Without some sample data and DDL it is difficult to say.

    You need to do something to ensure that only a one to one relationship exists.

Viewing 15 posts - 751 through 765 (of 1,491 total)