Forum Replies Created

Viewing 15 posts - 2,551 through 2,565 (of 3,544 total)

  • RE: Query Reg. Fetching Monthname

    DECLARE @monthnumber int

    SET @monthnumber = 9

    SELECT DATENAME(month,DATEADD(month,@monthnumber - 1,0))

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Copy Content from one table to other

    SELECT *

    INTO tableone

    FROM tablezero

    NOTE

    1. Select into/Bulk copy option must be set for database

    2. Primary Keys and Indexes will not be created for new table

    Alternatively

    CREATE TABLE tableone (col1,...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Conversion of Hexadecimal Value To String - Most Urgent

    Not that I know of but you could write one like this

    CREATE  FUNCTION fn_hextovarchar

        (@input varchar(8000), @startoffset int = 1)

    RETURNS varchar(4000)

    AS

    BEGIN

      DECLARE @hex char(16),@output varchar(4000),@ptr int,@val int

      SET @hex...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Devide by zero

    Divide by zero always returns null, the combination of ANSI_WARNINGS, ARITHABORT and ARITHIGNORE determines whether an error is produced or at what level the abort takes place (see BOL)

    So

    SET ANSI_WARNINGS OFF

    SET...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Question about bulk insert

    Use a FormatFile to specify the order and type of input data and in which columns to place the data. Note that any column not specified must be nullable.

    BOL has...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Forcing the workflow...

    In ExecuteSQL task, RAISERROR will cause the 'On Failure' workflow to trigger. eg

    IF NOT EXISTS (SELECT 1 FROM [sometable] WHERE [sometest])

    RAISERROR 'Record Does Not Exist',16,1

     

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Return counter in SELECT statement

    If the data is sorted on a column with unique values then you can do the following (uses pubs for example)

    select (select count(*)

      from pubs.dbo.stores s2

      where s2.stor_id...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Returning output parameters from stored procedures

    Increase the size of @Courses. It must be large enough to hold all the database names (including a comma) plus the final comma.

    This is how I do .NET

    Public...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Returning output parameters from stored procedures

    Try this

    alter procedure sp_GetUserValidation

    (

    @UserName varchar(50),

    @Courses varchar(50),

    @Return varchar(150) OUTPUT

    )

    AS

    SET NOCOUNT ON

    DECLARE @CourseName varchar(100), @UserValArray varchar(200), @Pos int

    DECLARE @sql nvarchar(500)

    DECLARE @Result char(1)

    SET @Return = ''

    SET @Courses = LTRIM(RTRIM(@Courses))

    IF @Courses = '' RETURN

    SET...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Wierd Issue

    Yes I would be interested as well. The OR method is the way I do it, the ISNULL I got from other threads on this site and seemed a simpler neater...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Updating multiple referance column data seperated by comma.

    If you have SQL2000, create a function

    CREATE Function dbo.fn_table1 (@col1 int)

    RETURNS varchar(1000)

    AS

    BEGIN

    DECLARE @result varchar(1000)

    SELECT @result = COALESCE(@result + ', ','') + CAST(NewCol1 as varchar)

    FROM...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Wierd Issue

    where col1 = isnull(@p1,col1)

    and col2 = isnull(@p2,col2)

    and col3 = isnull(@p3,col3)

    But beware this will invoke a table or index scan.

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Updating Table with values from another table ?

    UPDATE p

    SET p.EmployeeNo = i.EmployeeNo

    FROM [primary] p

    INNER JOIN [import] i

    ON i.LastName = p.LastName

    AND i.Initial = LEFT(p.FirstName,1)

    WHERE p.EmployeeNo IS NULL

    BUT BEWARE! This will...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Fuzzy logic matching routine problem

    Firstly I would remove the subqueries from the while statements and do them once at the beginning, ie

    declare @maxdataid int, @maxruleid int

    select @maxdataid = isnull(max([id]),0) from newdata

    select @maxruleid = isnull(max([id]),0)...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Fuzzy logic matching routine problem

    Created on the fly no testing

    Probable poor performance

    Assumes complete sql (including rules/test) less than 4000 bytes

    CREATE TABLE #tests (rowid int IDENTITY(1,1),test nvarchar(100))

    INSERT INTO #tests (test) values ('where rule1')

    INSERT...

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 15 posts - 2,551 through 2,565 (of 3,544 total)