Forum Replies Created

Viewing 15 posts - 46 through 60 (of 239 total)

  • RE: SQL Table question - Adding a secondary key

    If by key you mean unique index, then the following will work:

    create table test (col1 int primary key, col2 int)

    create unique index ux_test_col2 on test(col2)

  • RE: Accessing a remote SQL Server via HTTP

    Its a builtin feature of SQL 2005

  • RE: Timeouts & Deadlocks

    First, add some indexes.

    Second, a SELCT will create a SHARED lock on data that it has read until the SELECT is complete.  This will block writers so it is possible to...

  • RE: Bad performance in TSQL

    Also, check the definition of the views.  I've worked on systems with views nesting views many levels deep, with each level using the same tables, causing them to appear in the...

  • RE: Horrible response time with Update Query

    16 is fine (ANSI_PADDING ON).  They just have to be the same.

  • RE: SQL Stored Procedure Help

    Try this. 

    SELECT [columns]

    FROM   FinCenPersonal

    INNER JOIN Checks

    ON Checks.Payee like '%' + FinCenPersonal.last_name + '%'

    OR Checks.PurchasedBy like '%' + FinCenPersonal.last_name + '%'

    [follow pattern]

    Given a payee of 'Chuck Snyder', this...

  • RE: SQL Stored Procedure Help

    Didn't even notice that.  You should size the columns to some realistic size based upon the data.  Normally varchar(255) is more than sufficient for names, addresses and the like.

     

  • RE: SQL Stored Procedure Help

    IN doesn't do a partial match. 

    Try this:

    declare @t1 table (code varchar(20))

    insert @t1 values ('aaaa')

    insert @t1 values ('bbbb')

    insert @t1 values ('cccc')

    declare @t2 table (newcode varchar(20))

    insert @t2 values ('aaa')

    insert @t2 values...

  • RE: Export and Hiding Columns

    How are you getting the data from SQL to Excel? 

  • RE: Export and Hiding Columns

    Try using a SELECT statement

    Use SELECT Col1, Col3, ... ColN instead of SELECT *

  • RE: SQL Stored Procedure Help

    You don't need all the subselects and ins.  That will perform horribly.

    Try this. 

    SELECT FinCenPersonal.ID, FinCenPersonal.tracking_number, FinCenPersonal.last_name, FinCenPersonal.first_name, FinCenPersonal.middle_name,

           FinCenPersonal.suffix, FinCenPersonal.alias_last_name, FinCenPersonal.alias_first_name, FinCenPersonal.alias_middle_name,

           FinCenPersonal.alias_suffix, FinCenPersonal.number, FinCenPersonal.number_type, FinCenPersonal.dob, FinCenPersonal.street,...

  • RE: Horrible response time with Update Query

    Altering a column has the effect of setting ANSI_PADDING on for that column.  I've experienced problems where this caused an INDEX SCAN instead of an INDEX SEEK. 

    Check the value...

  • RE: UDF table lookup to override returned value of function

    Try something like this:

    create table holiday(holiday datetime primary key)

    insert holiday values ('01 Jan 2006')

    insert holiday values ('25 Dec 2006')

    go

    --in your function add

    if exists(select * from holiday where holiday = DATEADD(DD,...

  • RE: Horrible response time with Update Query

    Also check nullability.

  • RE: Is there a way to calculate percent of whole in one select statement

    I don't believe that will work.  Why do you want the sum(qty) for only one itemID?  Also, putting the subselect in the select statement is a bad idea because it...

Viewing 15 posts - 46 through 60 (of 239 total)