Viewing 15 posts - 961 through 975 (of 2,649 total)
ok. issue is the row separator
you defined it as \r - but it really is \n\r so the way the code is there will be a few records with hex...
January 6, 2022 at 10:33 pm
I've added some print statements to the following - run it again and the filename before the error will be the one failing - would need to look at that...
January 6, 2022 at 9:14 pm
try the following - untested
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Procedure [dbo].[import_dailytracing] @filepath varchar(500), @pattern varchar(100), @tablename varchar(100)
As
Begin
-- these 2 should always be set in ALL sp's
-- ...
January 6, 2022 at 6:13 pm
your issue is the blank lines at the end of the file - if this is always how you get them you have 3 options (in order of preference)
1 -...
January 6, 2022 at 5:12 pm
both files worked for me
if object_id('dbo.TestTracingImportSP') is not null
drop table dbo.TestTracingImportSP
create table dbo.TestTracingImportSP
(
[Initial] varchar(200)
,[Number] varchar(200)
,[Location City] varchar(200)
,[State] varchar(200)
,[Month] varchar(200)
,[Day] varchar(200)
,[Time] varchar(200)
,[L or E] varchar(200)
,[Event] varchar(200)
,[Train ID] varchar(200)
,[Destination...
January 6, 2022 at 4:52 pm
it is a double hop issue for sure - when you execute on the server the credentials are available locally so it can access the share - when you go...
January 6, 2022 at 4:41 pm
using "\n" worked fine for me with your sample file.
WITH (FIRSTROW=2, LASTROW=1000, FIELDTERMINATOR=',', ROWTERMINATOR='\n');
January 6, 2022 at 4:33 pm
as you state your table is partitioned maybe you can switch out each partition onto a staging table, convert the table (repeat for all partitions, one table per partition) and...
January 5, 2022 at 1:26 pm
I work on SQL server 2014 I need to rewrite update statement with best practice CAN I Write it without subquery ?
UPDATE FFFFF
SET...
January 4, 2022 at 11:34 pm
That's awesome, Frederico! Thanks for posting that.
It would appear, though, that you actually have to program for the table structure. Is there anything like the getting data from the...
January 4, 2022 at 8:21 am
better option for me would be to use a small powershell script to download the contents and load directly to sql server.
edit: the original link only extracts current year -...
January 4, 2022 at 12:52 am
kindly supply table and indexed DDL for all tables involved as well as row count for each table - and at same time do tell us why table TPartFeature does...
January 3, 2022 at 10:01 am
ssms is not BCP - and what you get on SSMS is in many cases totally out of sync with what you get with other tools.
on this case SSMs applies...
December 31, 2021 at 12:03 am
your expectation may not be what you can generate from sql using BCP - not knowing what options you are using I would advise using
"-c" which will add a \r\n...
December 30, 2021 at 9:24 pm
why don't you wish to use stuff?
you can use substring - but that will make your code a bit more complex.
on diff note - avoid hardcoding dbnames (use synonyms instead)...
December 27, 2021 at 10:28 pm
Viewing 15 posts - 961 through 975 (of 2,649 total)