Forum Replies Created

Viewing 15 posts - 31 through 45 (of 138 total)

  • RE: UPDATE not working

    Can you try this script ? :

    set nocount on

    go

    if object_id('dbo.person_identif_test') is not null drop table dbo.person_identif_test

    go

    create table dbo.person_identif_test

    (

        --id int not null identity(1,1),

        person_id...

  • RE: Creating Table with GetDate Function

    You do not need dynamic sql to do this. You can crate the table with a dummy name first, and use sp_rename to give it the name you want :

    declare...

  • RE: Export table data to textfiles with filename the same as tablename

    This is a new script. The first part ( up to the first go ) creates the stored procedure. This should only be executed once. The part after the go...

  • RE: Export table data to textfiles with filename the same as tablename

    Yes you can, but you have to create a format file for the bcp. If you want to continue using SQL script, you can try following script ( it uses...

  • RE: Export table data to textfiles with filename the same as tablename

    Hi,

    For 1) and 2), you could use a script like below. For 3), you should give some more details about what you want exactly. You can put the below script...

  • RE: Reading Dyanmic File Names

    I suppose you want load the file into a table. You can do this like this :

    declare @file varchar(1024)

    set @file = '''C:\abc2005_04_10.txt'''

    exec ('bulk insert tempdb.dbo.test from ' + @file )

    Or with...

  • RE: Schema changes and transactions

    You can use the DDL script generated by SQL Server Enterprise Manager as an example:

    "Right click" a table, choose Design Table.

    Make a minor modification to the table and click "Save...

  • RE: Strange bcp Behavior

    The option -F2 starts the copy from the second row. Try using -F3.

    You should also try to use BULK INSERT and not EXEC master..xp_cmdshell :

    BULK INSERT myDB.dbo.myTable from 'D:\Temp\download.csv'

    WITH (...

  • RE: loosing characters when inserting to a table

    I tried you script, and the insert works fine.

    Please verify if the option in QA ( Tools -> Options -> Results tab ) "Maximum characters per colomn" is set...

  • RE: Loop won''''t terminate

    Int can hold up to 2147483647. Smallint is limited to 32767 .

    From BOL:

    bigint

    Integer (whole number) data from -2^63 (-9,223,372,036,854,775,808) through 2^63-1 (9,223,372,036,854,775,807). Storage size is 8 bytes.

    int

    Integer (whole...

  • RE: Print Query Analyzer SQL in Colour?

    I use gvim, as I am used to work on Unix system. gvim is free, and it prints in color ...

    Bert

  • RE: Loop won''''t terminate

    Did you verify the log and data size ? Maybe the log or data file is full, and they can not grow ( not automatically grow, Restricted file growth or disk...

  • RE: Performance Question on Unions vs multiple inserts in temp table

    It all depends on the type of union.

    If it is a union ALL without an order by, the union will be faster, as the server will not need to use...

  • RE: Debate - .Net Dev Vs. DBA Who will win?

    In the code I see

    moDataConn.InitializeConnection()

    This is probably where the connection will be made. But the connection is never been closed ?!

    Before the return moDS, there should be a moDataConn.close()...

  • RE: Having Troubles with INSERT INTO

    Here is an exampl eusing dynamic SQL:

    You can use the proc like

    exec dbo.spTestTable -- will use Price2 column

    exec dbo.spTestTable 'Price3' -- will use Price3 column ...

    create proc dbo.spTestTable

    (

     @PriceCol...

Viewing 15 posts - 31 through 45 (of 138 total)