Forum Replies Created

Viewing 15 posts - 2,356 through 2,370 (of 3,544 total)

  • RE: SQL Bulk Insert - using " to wrap text fields

    Jeff,

    Nice solution if it was possible. As stated in BOL (SQL2K SP3) and in practice escaping double quotes (\") is not allowed with BCP.

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

  • RE: SQL Bulk Insert - using " to wrap text fields

    If you want to do this in T-SQL then you could do it this way

    CREATE TABLE test (F1 varchar(100))

    BULK INSERT test FROM 'c:\temp\test.csv' WITH ( ROWTERMINATOR = '\r\n' )

    DECLARE @updct...

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

  • RE: Question of the Day for 04 Mar 2005

    Good question, not sure about the correct answer though.

    I thought I would test this. First what is a temporary object in a procedure, a temp table seemed like the obvious...

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

  • RE: SQL Bulk Insert - using " to wrap text fields

    Bulk Insert (BCP) will not honour quotes and will treat them like normal data.

    Your best bet is to use DTS which will enable you to utilize the quotes correctly.

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

  • RE: Parsing Data

    I agree with Jonathan, use activex in DTS like this

    Function Main()

        strName = DTSSource("Whole_Name")

        strName = Replace(strName, ",", " ", 1, -1)

        strName = Replace(strName, ".", "...

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

  • RE: Get Time

    If the duration between the two dates is within an hour then

    DECLARE @date1 datetime, @date2 datetime

    SET @date1 = '20050224 13:12:04'

    SET @date2 = '20050224 13:47:52'

    SELECT RIGHT(CONVERT(varchar,DATEADD(second,DATEDIFF(second,@date1,@date2),0),108),5)

    Otherwise you...

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

  • RE: Views or Stored Procedure or UDFs : WHEN to use them ??

    quoteHey, if anyone knows of system function that does this

    You should be able to achieve the same...

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

  • RE: bcp utility problem

    What is the actual value of <zero-length value>

    If it contains 026 0x1A, then it represents ascii eof and the file will seem truncated to certain applications.

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

  • RE: BCP Error on import to field named DATABASE

    use the -q (quoted identifier) parameter to BCP

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

  • RE: Uploading Data from Text file with different column name

    Replace the code with this

    DECLARE @sql nvarchar(4000)

    SET @sql = 'INSERT INTO ' + @Tablename + '('

    SELECT @sql = @sql +

        COL_NAME(OBJECT_ID(@Tablename), ORDINAL_POSITION) +

        CASE WHEN ORDINAL_POSITION < (select count(*)...

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

  • RE: Uploading Data from Text file with different column name

    quote, after Every statement

    This would indicate that you have more data columns than columns in the table

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

  • RE: Frank''''s Addition to Family

    Well I wouldn't say mine is right or better, I always believed it was spelt colic but ...

    There is a word colicky (adjective)

    1 : relating...

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

  • RE: Uploading Data from Text file with different column name

    OK try this

    Create a udf

    CREATE FUNCTION dbo.udf_get_string

        (@str varchar(1000), @num int, @delim char(1))

    RETURNS varchar(100)

    AS

    BEGIN

    DECLARE @start int,@end int

    SET @end = 0

    WHILE (@num > 0)...

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

  • RE: Uploading Data from Text file with different column name

    OK, data type mismatch is as it states, there must be a problem with the data or column matching.

    To convert char date to datetime, use CAST(chardate as datetime). However if...

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

  • RE: Frank''''s Addition to Family

    quoteWho's next....?

    Not me! 

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

    Viewing 15 posts - 2,356 through 2,370 (of 3,544 total)