Forum Replies Created

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

  • 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...

  • RE: Export XML to Formatted File

    You can try the bcp utility to get the data out of SQL server.

    Try this : ( the generated xml is not OK, as the AUTO statement does not generate...

  • RE: Tesing If a linked server exists.

    I used osql

    1. to avoid the error message. Without osql you get this for an unknown server :

    Test :

    DECLARE @rc int

    EXEC @rc = dbo.usp_TestLinkedServer 'SQLTRIX'

    PRINT...

  • RE: Tesing If a linked server exists.

    Try this stored procedure : it returns 1 if the server link is OK, 0 if not...

    use master

    go

    if object_id('dbo.sp_VerifLinkedServer') is not null

     drop procedure dbo.sp_VerifLinkedServer

    go

    create procedure dbo.sp_VerifLinkedServer

    (

     @RemoteServer sysname

    )

    as

    begin

     set nocount on

     declare @cmd...

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