Showing posts with label automatically. Show all posts
Showing posts with label automatically. Show all posts

Wednesday, March 21, 2012

Row number in the dataflow task

Hello all,

I got a text file with two columns. and I need to generate a integer key automatically with the row number (or any distinct number, I thought row number will be OK). and when I make the data flow task to import this text file into a raw file I need to get the unique rownumber as Id.
How can I make this in the data flow tak?

regards,

This should work for you:

http://www.ssistalk.com/2007/02/20/generating-surrogate-keys/

|||

Did you try searching the forum? That question has been asked before and several are the ways of doing it:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=379124&SiteID=1

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1533040&SiteID=1

|||

Thank you.....

I am so happy with the script componant......

It works good.....

Thank you again.

Regards

Saturday, February 25, 2012

Round problem

Hi,
I am using sql statement to save data in SQL SERVER but even i did not apply any round function it is automatically rounding up. e.g. 3.56 when i see it in database it is 4 how can i avoid this rounding? I am using MS Access as front end.
Any help will be highly appreciated.What's the datatype in sql server?

Can you post the DDL of the table?

It'll need to be something like

decimal(15,2), float or real, numeric, money or smallmoney

I would use decimal

Did you ever fix your trigger?

Damn another fluff post...|||Hi Brett,
Here is table. Regarding Trigger , I could not solve it. Can you help me regarding that too?
CREATE TABLE [dbo].[VALID_ITEM] (
[DB_CONTRACT] [decimal](10, 0) NOT NULL ,
[PC_CODE] [int] NOT NULL ,
[ITEM_NO] [varchar] (7) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[NEW_ITEM] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[DESCPT] [varchar] (60) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[UNITS] [varchar] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[TYPE_ITEM] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[RET_PERC] [decimal](3, 0) NULL ,
[PROJQ] [decimal](11, 3) NULL ,
[CONTQ] [decimal](11, 3) NULL ,
[QTD] [decimal](11, 3) NULL ,
[TAMT_RET_ITEM] [decimal](12, 2) NULL ,
[TAMT_PAID_ITEM] [decimal](12, 2) NULL ,
[CONTR_PRICE] [decimal](12, 3) NULL ,
[IND_OVR_UND] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]|||Which column is rounding...but looks like you need precision...

gotta split...I'll check it in the am

Damn...another fluff post on my part|||Hi Brett,

The column [QTD] [decimal](11, 3) NULL is giving problem.

thanks|||You may want to look at how you are saving the data to the table. If you have access to Profiler you may want to run the SQLProfilerTSQL.tdf template and check the SQL statement passed to SQL Server. Chances are that access is rounding the value before passing it to SQL Server.|||hi,

I checked on MS Access side, access is not rounding it. I have profiler how can i run SQLProfilerTSQL.tdf ?

regards|||hi,

any one help me about my problem?

plzzzzzz|||Probably.

Post your SQL procedure code.|||Hi,
Here is the portion which is giving the problem

declare
@.var_vendor integer,
@.var_used_amt integer

set @.var_vendor = (select gen_contr from ae_contract where db_contract=@.var_db_contract)

BEGIN
update vendor
set used_amt = isnull(used_amt,0) + @.var_amt_result + @.var_amt_ret_result where db_vendor = @.var_vendor|||declare
@.var_vendor integer,
@.var_used_amt integer

This portion is doing the rounding. The value that is being rounded should have a data type of decimal with precision.

Also if you open Profiler, there is a list of templates that can show you the activity being sent to the SQL Server.|||hi,

Thank you very much..it worked...