FX Restatement BCP 10 MS
Hi,
We recently upgrader to BPC 10 from BPC7.5 and have a problem with some accounts that does not convert into other currencies when running the package FX Restatement. In BPC7.5 we had a few non-financial accounts that was converted into other currencies from LC by factor of 1. In our account-dim we had the property Rate-type empty and it worked fine. Now, in BPC10 it does not work for those accounts but works fine for all the other accounts?
We also tried to fill in a Rate-type value which we haven't used before, but we have values in the Rate model and it still doesn't work?
Any ideas, are we missing something?
How does the SPRUNCONVERSION work?
We dont get any error message when running the package, it just doesnt include the non-financial accounts.
Thanks,
Fredrik
Hi Fredrik,
Assuming that you have maintained all required properties in the all models (Finance, Rate). For currency conversion Rate type property is important. In rate type property you have to maintain valid member from Rate account(account that has been used in rate model) of the rate model. Normally we use "AVG","END","CLO","AVGFLOW","HISTBEQ". AVG normally used for P&L account and "CLO" or "END" used for balance sheet account. and then we configure the rules. For do currency conversion of P&L account we create separate rule and for balance sheet conversion we create other rule.
Basically we do currency conversion based on the rate type so rate type property will decide the source account for conversion. means for P&L account we maintain AVG and in rule we select AVG means all account who has rate type = "AVG" will be source account for that rule.
so similarly you create another rule for those account for which you have maintained another rate type.
But ensure that rate type property should be a valid member of account(rate model account).
for each account type maintain separate rule.
Hope cleared all doubts.
Similar Messages
-
Hello All,
Been looking into this for a couple of days, and I keep hitting brick walls, so I'm hoping someone can offer me a bit of inspiration. What I'm trying to do is write a stored procedure that lets the user specify a list of tables, and an output directory, and the SP creates a series of BCP statements that export these tables to comma delimited files.
This wouldn't be too hard, but I need to output the field headings in the first row of the table (and use quotes as text qualifiers). I'm doing this by looping round sys.columns, pulling out all the fieldnames, creating two select statements, and UNION ALL-ing them together. e.g.......
select 'FIELD1','FIELD2','FIELD3','FIELD4'
union all
select field1,field2,field3,field4 from tablename
It all works fine until you try it on a table with a lot of columns. Although you can build a big SQL statement in an NVARCHAR(MAX), BCP only appears to read the first 4000 characters of it, so it fails.
To get round this, I've moved all of the code that builds the big SQL statement to its own stored procedure (i.e. you pass the tablename, and it returns the table with the field names in the first row). Then, I can just call this new SP in my BCP statement, with a couple of parameters.
The problem I'm getting is BCP is complaining saying '[Microsoft][SQL Native Client]BCP host-files must contain at least one column'. I'm setting no count off, and there are no print statements, so I'm assuming this is because the data is getting returned via an exec sp_executesq (although this is a guess). I can't think of a way round this though, as the SQL need to be dynamic.
alter PROCEDURE [dbo].[sp_QBMultiFileExportGetData]
@tablename varchar(100),
@dbname varchar(100)
AS
BEGIN
declare @Execstring as nvarchar(MAX)
declare @currentfieldname as varchar(100)
declare @selectlist as varchar(8000)
declare @fieldnamelist as varchar(8000)
declare @colnames table
columnname varchar(100)
begin
set nocount on
set @execstring='select COLUMN_NAME '+
'from ' + @dbname + '.INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = ''' + @tablename + ''''
insert into @colnames(columnname)
exec sp_executesql @execstring
set @selectlist=''
set @fieldnamelist=''
--Loop through fieldnames, and build two strings
--One for outputting fieldnames and one for selecting the actual data
while exists(select * from @colnames)
begin
select top 1 @currentfieldname=columnname from @colnames
set @selectlist=@selectlist + 'quotename(['+ @currentfieldname + '],char(34)),'
set @fieldnamelist=@fieldnamelist + '''' + @currentfieldname + ''' [' +@currentfieldname + '],'
delete from @colnames where columnname=@currentfieldname
end
--remove last quote
set @selectlist=substring(@selectlist,1,len(@selectlist)-1)
set @fieldnamelist=substring(@fieldnamelist,1,len(@fieldnamelist)-1)
--Built string to execute, with fieldnames, and select fields
set @execstring='select ' + @fieldnamelist + ' union all select ' + @selectlist + ' from ' + @dbname + '..' + @tablename
return exec sp_executesql @execstring
end
END
this returns exactly what I want, but when I try to use it in a BCP statement, I get the error....
i.e.
EXEC master..xp_cmdshell 'bcp "exec QCDev.dbo.sp_QBMultiFileExportGetData ''tablename'',''dbname''" queryout C:\\outputfile.txt -T -t","'
Error = [Microsoft][SQL Native Client]BCP host-files must contain at least one column
Anyone ever tried this before?Hi Guys,
Thanks for the suggestions. I had been trying to avoid temp tables (don't really like them), but I think eventually, they were the only way to go. Unfortunately, this opened a whole can of scoping worms, and after a couple of hours, its all given me a right headache. However, the good news is I've finally got it working as I wanted.
I was finding I was having issues using temp tables, as the tables being used were dynamic, so I would have to create them in a dynamic SQL string, and they weren't propagating upwards from child to parent. I seemed to be getting the same problem using global temporary tables too, although I'm not sure why, as they should have worked They seemed to be out of scope by the time the SP that was calling my sp_QBMultiFileExportGetData tried to output the data. This might possibly have been because BCP wasn't seeing the same scope, but I've not tested it fully (and its very possible I was making a mistake).
The solution was to abandon sp_QBMultiFileExportGetData, and merge the code back into the calling script. However, rather than trying to pass an enormous SQL string to bcp, running it separately with sp_executesql, and dumping the results in a global temp table. Then let bcp just call a 'select * from temptable', to avoid the select statement getting too long. Its not the most elegant solution, but it seems to work fine.
ALTER PROCEDURE [dbo].[sp_QBMultiFileExport]
-- Add the parameters for the stored procedure here
@tablenames varchar(1000), --list of tables to be exported
@outputpath varchar(1000), --output path ***AS SEEN BY THE SERVER, NOT THE CLIENT***
@servername varchar(100), --Server where data resides
@dbname varchar(100), --database name
@delimiter varchar(1) --output delimiter
AS
BEGIN
declare @Execstring as nvarchar(max)
declare @currenttable as varchar(100)
declare @colnames table
columnname varchar(100)
declare @currentfieldname as varchar(100)
declare @selectlist as varchar(max)
declare @fieldnamelist as varchar(max)
--Get rid of CRLFs in the tablenames parameter
set @tablenames=replace(@tablenames,char(10),'')
set @tablenames=replace(@tablenames,char(13),'')
--add extra comma to the end of the list (needed later for consistency)
set @tablenames=@tablenames+','
--Get first table in the list
set @currenttable=substring(@tablenames,1,charindex(',',@tablenames)-1)
while @tablenames<>''
begin
--Get a list of fieldnames from syscols
insert into @colnames(columnname)
select COLUMN_NAME
from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = @currenttable
set @selectlist=''
set @fieldnamelist=''
while exists(select * from @colnames)
begin
--get first column name
select top 1 @currentfieldname=columnname from @colnames
--add to select statement lists
set @selectlist=@selectlist + 'quotename(['+ @currentfieldname + '],char(34)),'
set @fieldnamelist=@fieldnamelist + '''' + @currentfieldname + ''' [' +@currentfieldname + '],'
--remove column from temptable
delete from @colnames where columnname=@currentfieldname
end
--remove last quote from field lists
set @selectlist=substring(@selectlist,1,len(@selectlist)-1)
set @fieldnamelist=substring(@fieldnamelist,1,len(@fieldnamelist)-1)
--check for temp table, and drop if necessary
IF object_id('tempdb..##MultiFileExportTempTable') IS NOT NULL
BEGIN
DROP TABLE ##MultiFileExportTempTable
END
--Build list of fieldnames, and select list, unioned together
--and put the results in temptable
set @execstring='select ' + @fieldnamelist + ' into ##MultiFileExportTempTable union all select ' + @selectlist + ' from ' + @dbname + '..' + @currenttable
exec sp_executesql @execstring
--get BCP to pull data back from ##temptable, and dump in file
set @execstring='EXEC master..xp_cmdshell ''bcp "select * from ##MultiFileExportTempTable" queryout ' + @outputpath + '\' + @currenttable + '.txt' + ' -c -T -t"' + @delimiter + '"'''
exec sp_executesql @execstring
--drop tablename from list
set @tablenames=replace(@tablenames,@currenttable + ',','')
--if tablenames list is not empty, get the next one
if @tablenames<>''
set @currenttable=substring(@tablenames,1,charindex(',',@tablenames)-1)
else
set @currenttable=''
end
IF object_id('tempdb..##MultiFileExportTempTable') IS NOT NULL
BEGIN
DROP TABLE ##MultiFileExportTempTable
END
END
So, you call this with...
exec dbo.[sp_QBMultiFileExport] 'table1,table2,table3',filepath,servername,dbname,delimiter
...and it creates delimited files called table1.txt, table2.txt and table3.txt in the specified folder, with field headings and text qualifiers.
Many thanks for all your suggestions -
Restatement and COPA Reporting
Hello Everyone,
I was wondering if anyone could share their experience with COPA reports with restatement...basically how to handle COPA restatement and reports. Any pitfalls, anything at all.
Thanks everyone,
ColleenHi Ashok,
My email is [email protected]
Thanks,
Colleen -
How to export data with column headers in sql server 2008 with bcp command?
Hi all,
I want know "how to export data with column headers in sql server 2008 with bcp command", I know how to import data with import and export wizard. when i
am trying to import data with bcp command data has been copied but column names are not came.
I am using the below query:-
EXEC master..xp_cmdshell
'BCP "SELECT * FROM [tempdb].[dbo].[VBAS_ErrorLog] " QUERYOUT "D:\Temp\SQLServer.log" -c -t , -T -S SERVER-A'
Thanks,
SAAD.Hi All,
I have done as per your suggestion but here i have face the below problem, in print statment it give correct query, in EXEC ( EXEC master..xp_cmdshell @BCPCMD) it was displayed error message like below
DECLARE @BCPCMD
nvarchar(4000)
DECLARE @BCPCMD1
nvarchar(4000)
DECLARE @BCPCMD2
nvarchar(4000)
DECLARE @SQLEXPRESS
varchar(50)
DECLARE @filepath
nvarchar(150),@SQLServer
varchar(50)
SET @filepath
= N'"D:\Temp\LDH_SQLErrorlog_'+CAST(YEAR(GETDATE())
as varchar(4))
+RIGHT('00'+CAST(MONTH(GETDATE())
as varchar(2)),2)
+RIGHT('00'+CAST(DAY(GETDATE())
as varchar(2)),2)+'.log" '
Set @SQLServer
=(SELECT
@@SERVERNAME)
SELECT @BCPCMD1
= '''BCP "SELECT
* FROM [tempdb].[dbo].[wErrorLog] " QUERYOUT '
SELECT @BCPCMD2
= '-c -t , -T -S '
+ @SQLServer +
SET @BCPCMD
= @BCPCMD1+ @filepath
+ @BCPCMD2
Print @BCPCMD
-- Print out below
'BCP "SELECT
* FROM [tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername'
EXEC
master..xp_cmdshell
@BCPCMD
''BCP' is not recognized as an internal or external command,
operable program or batch file.
NULL
if i copy the print ourt put like below and excecute the CMD it was working fine, could you please suggest me what is the problem in above query.
EXEC
master..xp_cmdshell
'BCP "SELECT * FROM
[tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername '
Thanks, SAAD. -
[Forum FAQ] How to use multiple field terminators in BULK INSERT or BCP command line
Introduction
Some people want to know if we can have multiple field terminators in BULK INSERT or BCP commands, and how to implement multiple field terminators in BULK INSERT or BCP commands.
Solution
For character data fields, optional terminating characters allow you to mark the end of each field in a data file with a field terminator, as well as the end of each row with a row terminator. If a terminator character occurs within the data, it is interpreted
as a terminator, not as data, and the data after that character is interpreted and belongs to the next field or record. I have done a test, if you use BULK INSERT or BCP commands and set the multiple field terminators, you can refer to the following command.
In Windows command line,
bcp <Databasename.schema.tablename> out “<path>” –c –t –r –T
For example, you can export data from the Department table with bcp command and use the comma and colon (,:) as one field terminator.
bcp AdventureWorks.HumanResources.Department out C:\myDepartment.txt -c -t ,: -r \n –T
The txt file as follows:
However, if you want to bcp by using multiple field terminators the same as the following command, which will still use the last terminator defined by default.
bcp AdventureWorks.HumanResources.Department in C:\myDepartment.txt -c -t , -r \n -t: –T
The txt file as follows:
When multiple field terminators means multiple fields, you use the below comma separated format,
column1,,column2,,,column3
In this occasion, you only separate 3 fields (column1, column2 and column3). In fact, after testing, there will be 6 fields here. That is the significance of a field terminator (comma in this case).
Meanwhile, using BULK INSERT to import the data of the data file into the SQL table, if you specify terminator for BULK import, you can only set multiple characters as one terminator in the BULK INSERT statement.
USE <testdatabase>;
GO
BULK INSERT <your table> FROM ‘<Path>’
WITH (
DATAFILETYPE = ' char/native/ widechar /widenative',
FIELDTERMINATOR = ' field_terminator',
For example, using BULK INSERT to import the data of C:\myDepartment.txt data file into the DepartmentTest table, the field terminator (,:) must be declared in the statement.
In SQL Server Management Studio Query Editor:
BULK INSERT AdventureWorks.HumanResources.DepartmentTest FROM ‘C:\myDepartment.txt’
WITH (
DATAFILETYPE = ‘char',
FIELDTERMINATOR = ‘,:’,
The new table contains like as follows:
We could not declare multiple field terminators (, and :) in the Query statement, as the following format, a duplicate error will occur.
In SQL Server Management Studio Query Editor:
BULK INSERT AdventureWorks.HumanResources.DepartmentTest FROM ‘C:\myDepartment.txt’
WITH (
DATAFILETYPE = ‘char',
FIELDTERMINATOR = ‘,’,
FIELDTERMINATOR = ‘:’
However, if you want to use a data file with fewer or more fields, we can implement via setting extra field length to 0 for fewer fields or omitting or skipping more fields during the bulk copy procedure.
More Information
For more information about filed terminators, you can review the following article.
http://technet.microsoft.com/en-us/library/aa196735(v=sql.80).aspx
http://social.technet.microsoft.com/Forums/en-US/d2fa4b1e-3bd4-4379-bc30-389202a99ae2/multiple-field-terminators-in-bulk-insert-or-bcp?forum=sqlgetsta
http://technet.microsoft.com/en-us/library/ms191485.aspx
http://technet.microsoft.com/en-us/library/aa173858(v=sql.80).aspx
http://technet.microsoft.com/en-us/library/aa173842(v=sql.80).aspx
Applies to
SQL Server 2012
SQL Server 2008R2
SQL Server 2005
SQL Server 2000
Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.Thanks,
Is this a supported scenario, or does it use unsupported features?
For example, can we call exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='b64ce7ec-d598-45cd-bbc2-ea202e0c129d'
in a supported way?
Thanks! Josh -
BCP data into a file using Runtime class
Hi,
I have a problem in using the Runtime class.
I am trying to bcp a table's data into a file.I am working on a Unix environment.
My bcp is not getting completed fully.The total records to be bcped is 1 million,but only one lakh records is getting bcped and then it hangs up..But if i issue the bcp command from my telnet session it is bcping it to the file without any problem.Can anyone help me out on how to overcome this..
Is there anything specific with Runtime class..I am pasting the code that i tried out below.
String l_s_bcpQuery="bcp mubstage.dbo.HousingUnitSampleMarket out /dun/d3nmb0/mariaps/subracheckprototype -c -t~ -Umariaps -Prykwz5ba -SD3NMB_MUB";
try{
Runtime time=Runtime.getRuntime();
Process p=time.exec(l_s_bcpQuery);
p.waitFor();
System.out.println("The exit value is:"+p.exitValue());
}catch(Exception ioe){
ioe.printStackTrace();
System.out.println("IOException"+ioe.getMessage());you might need to capture the stout & sterr from the process. see http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Process.html, or many other similar questions on this forum.
try this:
try{
Runtime time=Runtime.getRuntime();
Process p=time.exec(l_s_bcpQuery);
BufferedReader stout = new BufferedReader(new InputStreamReader(p.getInputStream()));
BufferedReader sterr = new BufferedReader(new InputStreamReader(p.getErrorStream()));
String out = stout.readLine();
String err = sterr.readLine();
while((out != null)||(err != null))
if(out != null)
System.out.println(out);
if(err != null)
System.err.println(err);
out = stout.readLine();
err = sterr.readLine();
int exit_value = p.waitFor();
System.out.println("The exit value is:"+ exit_value);
}catch(Exception ioe){
ioe.printStackTrace();
System.out.println("IOException"+ioe.getMessage());
} -
I am trying to export the file using bcp and my error is
C:\Users\rajesh>bcp Adventureworks.HumanResources.Department out c:\test\dept.txt -n -SLaasya -T
SQLState = 37000, NativeError = 4060
Error = [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot open databa
se "Adventureworks" requested by the login. The login failed.
SQLState = 28000, NativeError = 18456
Error = [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for u
ser 'LAASYA\rajesh'.
I am new to sql.please help me..>>Error = [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'LAASYA\rajesh'.
The error message is very clear. Are you able to connect to the database
Adventureworks using windows authentication? If you want to use the SQL Authentication use the -U and -P options and remove -T option from BCP
Satheesh
My Blog |
How to ask questions in technical forum -
Bcp error with SQL Server 2008
In working through the 70-432 training material, I have entered the follwing:
bcp AdventureWorks
.HumanResources.Department out
c:
\test/department.txt -c -S HOME -T
I receive the error message -- Could not find stored procedure'bcp'.
and a syntax error after c: What am I missing?Where are you entering these commands?
BCP is a command line program. NOte that there is a typo in teh code you pasted and is your server name HOME?
bcp AdventureWorks.HumanResources.Department out c:\test\department.txt -c -S HOME -T
Refer below for more details.
http://msdn.microsoft.com/en-us/library/ms162802.aspx| Sankar Reddy | http://sankarreddy.spaces.live.com/ | -
BCP is not working in when i am executing using xp_cmdshell
Declare @cmd varchar(300)
Set @cmd=
'bcp "SELECT definition + char(13) + ''GO'' FROM test.sys.sql_modules s INNER JOIN test.sys.procedures p ON [s].[object_id] = [p].[object_id]
WHERE p.name LIKE ''create%''" queryout "V:\SQLBackups\SP_scripts.sql" -C -T -t -w'
exec xp_cmdshell @cmd
below is the result i am getting its not creating any sql script its working perfectly from cmd prompt
usage: bcp {dbtable | query} {in | out | queryout | format} datafile
[-m maxerrors] [-f formatfile] [-e errfile]
[-F firstrow] [-L lastrow] [-b batchsize]
[-n native type] [-c character type] [-w wide character type]
[-N keep non-text native] [-V file format version] [-q quoted identifier]
[-C code page specifier] [-t field terminator] [-r row terminator]
[-i inputfile] [-o outfile] [-a packetsize]
[-S server name] [-U username] [-P password]
[-T trusted connection] [-v version] [-R regional enable]
[-k keep null values] [-E keep identity values]
[-h "load hints"] [-x generate xml format file]
[-d database name] [-K application intent]
NULL
any help is highly appreciated
Thanks
AKissue got resolved sql command should be in single line :)
-
"BCP Commit Failed" New Install On Windows 2008 R2 with SQL Server 2008 R2
I am installing a new Netweaver install on a virtual machine loaded with Windows 2008 R2 and SQL Server 2008 R2. The install gets to the "Import ABAP" phase and just hangs. SAPINST says it is still running, but there is no activity to suggest there is anything going on. There are no errors in the main logs, but after digging a little I did find these errors in the SAPSDIC.log file.
(IMP) INFO: EndFastLoad failed with <2: BCP commit failed:[Microsoft][SQL Server Native Client 10.0][SQL Server]Violation of PRIMARY KEY constraint 'BADI_CHAR_COND~0'.>
(IMP) ERROR: EndFastload: rc = 2
(DB) INFO: BADI_FILTER created
(DB) INFO: BADI_FILTER~0 created
(IMP) INFO: EndFastLoad failed with <2: BCP commit failed:[Microsoft][SQL Server Native Client 10.0][SQL Server]Violation of PRIMARY KEY constraint 'BADI_FILTER~0'. Ca>
(IMP) ERROR: EndFastload: rc = 2
(DB) INFO: BADI_IMPL created
(DB) INFO: BADI_IMPL~0 created
(IMP) INFO: EndFastLoad failed with <2: BCP commit failed:[Microsoft][SQL Server Native Client 10.0][SQL Server]Violation of PRIMARY KEY constraint 'BADI_IMPL~0'. Cann>
(IMP) ERROR: EndFastload: rc = 2
Anyone have any ideas as to what might be going on? I can't find anyone with this exact same error. And this is our first attempt at installing a system with Windows 2008 R2 and SQL Server 2008 R2. All of our other Windows SAP systems are on Windows 2003 and SQL Server 2005 and we're in the process of upgrading - this being the first system.
Thanks in advance,
MichaelSet BCP_LOB=1 in your system environment
Note 1156361 - R3load: Fastload doesn't support LOB-columns
Markus -
BCP - Error with column text in sql server 2000
Hi,
Im trying to restore a bcp using the command:
bcp "db.dbo.tb_log_old" in "tb_log2013.out" -SSERVER -T -n
Im using SQL 2000 with the table below
CREATE TABLE [dbo].[tb_log_old](
[cd_id] [int] NULL,
[cd_servico] [int] NULL,
[dt_ocorrencia] [datetime] NULL,
[nm_xml_entrada] [text] NULL,
[nm_xml_saida] [text] NULL,
[dt_inicio_processamento] [datetime] NULL,
[dt_fim_processamento] [datetime] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
I have got the error
Starting copy...
SQLState = S1001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Memory allocation failure
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Text column data incomplete
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Text column data incomplete
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Text column data incomplete
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Text column data incomplete
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Text column data incomplete
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Text column data incomplete
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Text column data incomplete
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Text column data incomplete
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Text column data incomplete
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Text column data incomplete
SQLState = 37000, NativeError = 4810
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Expected the TEXT token in data stream for bulk copy of text or image data.
BCP copy in failedI tried with binary and nvarchar but I got the error below:
Can I get just 2 columns in the bcp?
Starting copy...
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
BCP copy in failed -
How to load decimal values into a file using bcp in SQL Server 2000?
Hi everyone,
I'm trying to load data from a database table to a text file using bcp on SQL Server 2000. When I'm loading the decimal values, the values before the decimal are not being loaded into the file. How could I load the values before decimals?
Here are the DDLs and DMLs of what I'm trying to run:
CREATE TABLE [dbo].[Product_Sales](
[Year_of_Sale] [smallint] NOT NULL,
[Product_Type] [varchar](25) NOT NULL,
[Product_Group] [varchar](25) NOT NULL,
[Category_Type] [varchar](25) NOT NULL,
[Category_Group] [varchar](10) NOT NULL,
[Product_Count] [bigint] NOT NULL,
[Product_Amount] [decimal](19, 2) NOT NULL,
[Category_Count] [bigint] NOT NULL,
[Category_Amount] [decimal](19, 2) NOT NULL,
CONSTRAINT [PK_Product_Sales] PRIMARY KEY CLUSTERED
[Year_of_Sale] ASC,
[Product_Type] ASC,
[Product_Group] ASC,
[Category_Type] ASC,
[Category_Group] ASC
) ON [PRIMARY]
) ON [PRIMARY]
INSERT INTO [Yearly_Sales].[dbo].[Product_Sales]
VALUES(2010, 'Online', 'Web', 'Cameras', 'Electronics', 547, 0.00, 0, 0.00)
EXEC [master].[dbo].[xp_cmdshell] 'bcp "SELECT * FROM [Yearly_Sales].[dbo].[Product_Sales]" queryout D:\Yearly_Sales\Product_Sales.dat -c -T -S'
And the output I see in the file is:
2010 Online Web Cameras Electronics 547 .00 0 .00
The values before decimals are being truncated.
Thanks,
Bangaaram
Known is a DROP, Unknown is an OCEAN.You can modify the decimal column(s) in the table to varchar type before export. But it does not look good.
alter table [dbo].[Product_Sales]
Alter column [Product_Amount] varchar(20)
alter table [dbo].[Product_Sales]
Alter column [Category_Amount] varchar(20)
Does that make any sense?
Known is a DROP, Unknown is an OCEAN.
Basically you modify the decimal column to a varchar type before you run the bcp command for export. You can modify your source table or you can modify them on the fly. It is just a workaround.
Modifying the source wouldn't be a good idea. Never do that if you can't get your desired output.
Known is a DROP, Unknown is an OCEAN. -
I forget to charge my MacBook Pro and it turned off because of that. Now it wont automatically connect to saved networks. I have to put in manually to make it work. Even after restating still the same. If I close the lid it looses conection. Sometimes pulling the Battery out will fixes it untill we forget to chage it.
Mac OS X version 10.6.8I forget to charge my MacBook Pro and it turned off because of that. Now it wont automatically connect to saved networks. I have to put in manually to make it work. Even after restating still the same. If I close the lid it looses conection. Sometimes pulling the Battery out will fixes it untill we forget to chage it.
Mac OS X version 10.6.8 -
Restating of Customer and Vendor Documents
Dear All,
Kindly clear some of my doubts related to restating as of year end-
What is the procedure for restating vendor and customer accounts as on 31.03.11 if any of the foreign currency transactions are outstanding as on year end? ((This may include both invoices as well as advance payments. The vendors
invoices may include bills accounted on different exchange rates which are unpaid as on 31.03.11 to be restated as on year end exchange rate))
Also pl clarify the below points.
Where we have to update the year end exchange rate in the system and whether the system will restate all the documents which are in open items as on 31.03.11.
And,
Whether the restated document will be reversed in the next financial year.
Regards,
Prashant GoelPlease check the below path to create a valuation method and area and their assignment
Financial Accounting (New) >General Ledger Accounting (New) > Periodic Processing > Valuate
You need to maintain the exchange rate type in valuation methods step and exchange rates have to be maintained to this type in OB08.
System posts the Fx unrealized differences at year end and next year first date same can be reversed as these are just unrealized.
Rgds
Murali. N -
I'm running SQL Server 2008 R2 and trying to test out bcp in one of our databases. For almost all the tables, the bcp and bulk insert work fine using similar commands below. However on a few tables I am experiencing an issue when trying to Bulk Insert
in.
Here are the details:
This is the bcp command to export out the data (via simple batch file):
1.)
SET OUTPUT=K:\BCP_FIN_Test
SET ERRORLOG=C:\Temp\BCP_Error_Log
SET TIMINGS=C:\Temp\BCP_Timings
bcp "SELECT * FROM FS84RPT.dbo.PS_PO_LINE Inner Join FS84RPT.[dbo].[PS_RECV_LN_ACCTG] on PS_PO_LINE.BUSINESS_UNIT = PS_RECV_LN_ACCTG.BUSINESS_UNIT_PO and PS_PO_LINE.PO_ID= PS_RECV_LN_ACCTG.PO_ID and PS_PO_LINE.LINE_NBR= PS_RECV_LN_ACCTG.LINE_NBR WHERE
PS_RECV_LN_ACCTG.FISCAL_YEAR = '2014' and PS_RECV_LN_ACCTG.ACCOUNTING_PERIOD BETWEEN '9' AND '11' " queryout %OUTPUT%\PS_PO_LINE.txt -e %ERRORLOG%\PS_PO_LINE.err -o %TIMINGS%\PS_PO_LINE.txt -T -N
2.)
BULK INSERT PS_PO_LINE FROM 'K:\BCP_FIN_Test\PS_PO_LINE.txt' WITH (DATAFILETYPE = 'widenative')
Msg 4869, Level 16, State 1, Line 1
The bulk load failed. Unexpected NULL value in data file row 2, column 22. The destination column (CNTRCT_RATE_MULT) is defined as NOT NULL.
Msg 4866, Level 16, State 4, Line 1
The bulk load failed. The column is too long in the data file for row 3, column 22. Verify that the field terminator and row terminator are specified correctly.
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.
Msg 7330, Level 16, State 2, Line 1
Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".
I've tried a few different things including trying to export as character and import as BULK INSERT PS_PO_LINE FROM 'K:\BCP_FIN_Test\PS_PO_LINE.txt' WITH (DATAFILETYPE = 'char')
But no luck
Appreciate helpIt seems that the target table does not match your expectations.
Since I don't know exactly what you are doing, I will have to resort to guesses.
I note that you export query goes:
SELECT * FROM FS84RPT.dbo.PS_PO_LINE Inner Join
And then you are importing into a table called PS_PO_LINE as well. But for your operation to make sense the import PS_PO_LINE must not only have the columns from the PS_PO_LINE, but also all columns from PS_RECV_LN_ACCTG. Maybe your SELECT should read
SELECT PS_PO_LINE.* FROM FS84RPT.dbo.PS_PO_LINE Inner Join
or use an EXISTS clause to add the filter of PS_RECV_LN_ACCTG table. (Assuming that it appears in the query for filtering only.)
Erland Sommarskog, SQL Server MVP, [email protected]
Maybe you are looking for
-
Ipod not seen in Itunes 7.0.1
This is a real pain. I upgraded Itunes to 7.0.1 and it stopped recognizing my Ipod. The only way I can get it to see the ipod is by stopping and restarting the Ipod service in the computer management window. But once I tunes sees the Ipod and tries t
-
Convert the Flat file format to XSTRING.
hi experts, I need to convert the flat file(.txt,.pdf....) to an internal table as the XSTRING.
-
Where do I download disc menu templates for Adobe Premiere Elements 10?
Where do I download disc menu templates for Adobe Premiere Elements 10?
-
Bought music through iTunes on the iPhone, but music gone
I purchased an album ($7.99) from my iTunes app on my iPhone 3G before the iPhone update OS4. I then pluged my phone into the computer and did the update to OS4. Now, all my music is gone, and no where to be found on my iTunes on my computer. To my s
-
Unable to open .cfm files
I need to be able to open .cfm files, which were no problem in Windows. However, since switching to iMac, I am not able to open the .cfm files in Pages, Word for Mac, using Adobe Reader, etc. Does anyone else have the same problem and/or know the sol