Performance operations based on Column values in SQL server 2008

Hi ,
I have a table which consist of following columns
ID    Formula              
Values                 
DisplayValue
1                    
a*b/100       100*12/100    
      null
2                    
b*c/100       
12*4/100              
null
I want to perform operation based on column "Values" and save data after operations in new column Name "Display Value" .i.e I want to get the below result . Can anyone please help.
ID    Formula              
Values                 
DisplayValue
1                    
a*b/100       100*12/100    
      12
2                    
b*c/100       
12*4/100             
0.48
Thanks for the help.
Regards, Priti A

Try this,
create table #mytable (ID int,Formula varchar(10), [Values] varchar(10), DisplayValue decimal(10,4))
insert into #mytable values(1 ,'a*b/100','100*12/100',null)
insert into #mytable values(2 ,'b*c/100','12*4/100',null)
declare @rowcount int=1
while @rowcount <= (select max(id) from #mytable)
begin
declare @expression nvarchar(max)
select @expression=[values] from #mytable where id = + @rowcount
declare @sql nvarchar(max)
set @sql = 'select @result = ' + @expression
declare @result decimal(10,4)
exec sp_executesql @sql, N'@result decimal(10,4) output', @result = @result out
update #mytable set DisplayValue= @result where id = @rowcount
set @rowcount=@rowcount+1
end
select * from #mytable
Regards, RSingh

Similar Messages

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

  • Reset Identity Column Value in SQL Server depending on whats being inserted

    I have a SQL Server 2008 database with a table that has an ID field that has an identity increment and seed of 1.
    This work great as each new record created automatically gets a new and distinct number.
    Now when I insert certain new records I need to be able to make that value start at 10001 and then the next would be 10002 etc.
    But this is only for certain inserts.
    Is there a way to control the identity seed & increment on the fly via a query maybe?
    So some inserts would follow 1,2,3,4,5,6,7  depending on whats being inserted
    and others would follow 10001,10002,10003 depending on whats being inserted.
    is this possible?

    Make it a different field.  Don't mess with your PK.
    Make sure you have a plan for when you get 10000 records in this table.

  • How to update the identity_column value in sql server 2008

    Hi Team,
    I have identity column based table. In the table i use insert the name as per the requirement and for ID i use to set the identity now i need to update the particular row id.
    when i use to trying i'm getting the below error.
    Msg 8102, Level 16, State 1, Line 4
    Cannot update identity column 'CategoryID'.
    Kindly help me out regarding this.
    Thanks & Regards,
    Ramesh R

    You cannot update an IDENTITY column. You need to move the data into another table make  the changes over there  and insert the back the data into original table.
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • @@ServerName returns wrong value in SQL SERVER 2008

    One of my production server configured as Mirror server. When i run @@ServerName query on Principal server i got right server name. but when i execute same query on mirror server it returns Principal server name. I have windows server 2008. I don't know
    why it happens.
    Shamas Saeed (if Post helpful please mark as Answer) http://shamas-saeed.blogspot.com

     
    Unfortunately this won't help, since sp_dropserver '[name]' is used for dropping  the name of
    @@servername, not for the name of
    SERVERPROPERTY('ServerName').   
    SERVERPROPERTY('ServerName')  is wrong while @@servername
    is right.
    In this sql server, there are two sql services:  one is the default server name, and another is the wrong instance name
    SQLBEYONDPAY\SQLC.
    Currently, when I connect to SQLCBP instance, when I select SERVERPROPERTY('ServerName'), it returns
    SERVERPROPERTY('ServerName') =SQLBEYONDPAY\SQLC (bad name), it needs to be 'SQLCBP' instead. When I select
    @@servername, it returns SQLCBP (good) already.

  • How to merge three columns values to single row values in sql server 2008

    Hi Frds.....
    I have three quantity in my table.
    Quantity1,quantity2,quantity3
    this three quantity have different values
    ex:
    quantity1 = 1000,quantity2=2000,quantity3=3000
    the three column combine 2 display in single row values. this values display in one by one.
    ex: quantity
         1000
         2000
         3000

    You will need to use the UNPIVOT operator:
    DECLARE @example TABLE
    Id int NOT NULL IDENTITY(1,1),
    Quantity1 int,
    Quantity2 int,
    Quantity3 int
    INSERT INTO @example VALUES (1000, 2000, 3000), (4000, 5000, 6000);
    SELECT * FROM @example;
    SELECT Id, Quantity, QuantityType
    FROM @example
    UNPIVOT
    Quantity FOR QuantityType IN (Quantity1, Quantity2, Quantity3)
    ) AS u;
    Output:
    (2 row(s) affected)
    Id Quantity1 Quantity2 Quantity3
    1 1000 2000 3000
    2 4000 5000 6000
    (2 row(s) affected)
    Id Quantity QuantityType
    1 1000 Quantity1
    1 2000 Quantity2
    1 3000 Quantity3
    2 4000 Quantity1
    2 5000 Quantity2
    2 6000 Quantity3
    (6 row(s) affected)

  • Attempted to perform an unauthorized operation error while installing SQL Server 2008 R2 Enterprise edition on Windows Server 2012 R2 standard VM server

    I've been trying fresh installation of SQL Server 2008 R2 enterprise on Windows Server 2012 R2 standard VM server several times for two weeks, but always get the error "Attempted to perform an unauthorized operation". At first, I attempted
    to install all features, but failed several times. So I decided to try install just Database Engine service, and still fail at the SqlBrowserConfigAction_Install_ConfigNonRC_Cpu32, with the error "Attempted to perform an unauthorized operation".
    I remote login to server with my admin domain account. This account is in server local Administrators group. I
    1. Right-click on setup.exe file | properties | Compatibility tab | select compatibility to Windows 8.Then click OK.
    2. Right-click on setup.exe file | Run as Administrator, to start the Installation Center.
    I have the document of my installation steps and zip file of the installation logs, if you need to take a look.
    Appreciate for any help!
    ntth

    Hi ntth,
    "Attempted to perform an unauthorized operation"
    The above error is always related to the Windows account SID mapping. I recommend you login into Windows using another Windows account which has administrative privileges and run SQL Server setup using that Windows account.
    Besides, please note that we need to apply SQL Server 2008 R2 Service Pack 2 or a later update when installing SQL Server Windows Server 2012 R2. For more information, please review this
    KB article.
    Thanks,
    Lydia Zhang
    If you have any feedback on our support, please click
    here.
    Lydia Zhang
    TechNet Community Support

  • Attempted to perform an unauthorized operation error on windows 8.1 while installing SQL server 2008

    Hi,
    I am getting the error "Attempted to perform an unauthorized operation" on windows 8.1 while installing
    SQL server 2008.
    The specific error is The error is Attempted to perform an unauthorized operation."
    at stepSqlBrowserConfigAction_install_ConfigNonRC_Cpu32 .
    I have tried everything from copying to the C drive. I am the admin on the machine. I also checked access in registry. It already has acesss to HKLM\System\CurrentControlSet\Control\WMI\security
    Can someone comment on how to resolve this issue. I also tried NT
    AUTHORITY\SYSTEM but getting the same error.
    Any help would be appreciated.

    Hello,
    Please note that SQL Server 2008 requires Service Pack 3 (SP3) to make it compatible with
    Windows 8.1. Please perform an slipstream installation of SQL Server 2008 + SP3:
    http://support.microsoft.com/kb/955392
    If it fails again, please share with us the Summary.txt log file and the details.txt log file. The following article
    may help you locate those files on disk::
    http://msdn.microsoft.com/en-us/library/ms143702(v=sql.100).aspx
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • SQL Server 2008 Developer install failed - Attempted to perform an unauthorized operation

    I'm trying to install SQL Server 2008 Developer edition on my laptop running Windows XP Professional SP2.  I ran the installer as a domain user with admin rights to the local box.  The installation advisor program certified that my system was ready for the install, but nevertheless I had to uninstall SQL Server 2005 Express edition and install .NET framework 3.5 SP1 first.  Once that was done, the installer finished, having successfully installed all the components of SQL Server 2008 except for the core database engine.  It failed with this error message: Attempted to perform an unauthorized operation.
    I uninstalled SQL Server 2008 and reinstalled with the same results.
    Below is a snippet from my C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20081014_203925\Detail.txt which seems like it may be relevant.
    Can anyone offer any assistance?  Would be greatly appreciated.
    2008-10-14 20:50:15 SQLEngine: --EtwSetup: Updating WMI Security
    2008-10-14 20:50:15 SQLEngine: --EtwSetup: WMI sddlA;;0x120fff;;;SY)(A;;0x120fff;;;BA)
    2008-10-14 20:50:15 Slp: Sco: Attempting to create base registry key HKEY_LOCAL_MACHINE, machine
    2008-10-14 20:50:15 Slp: Sco: Attempting to open registry subkey SYSTEM\CurrentControlSet\Control\WMI\Security
    2008-10-14 20:50:15 Slp: Prompting user if they want to retry this action due to the following failure:
    2008-10-14 20:50:15 Slp: ----------------------------------------
    2008-10-14 20:50:15 Slp: The following is an exception stack listing the exceptions in outermost to innermost order
    2008-10-14 20:50:15 Slp: Inner exceptions are being indented
    2008-10-14 20:50:15 Slp:
    2008-10-14 20:50:15 Slp: Exception type: Microsoft.SqlServer.Configuration.Sco.ScoException
    2008-10-14 20:50:15 Slp:     Message:
    2008-10-14 20:50:15 Slp:         Attempted to perform an unauthorized operation.
    2008-10-14 20:50:15 Slp:     Data:
    2008-10-14 20:50:15 Slp:       WatsonData = HKEY_LOCAL_MACHINE@SYSTEM\CurrentControlSet\Control\WMI\Security
    2008-10-14 20:50:15 Slp:       DisableRetry = true
    2008-10-14 20:50:15 Slp:     Inner exception type: System.UnauthorizedAccessException
    2008-10-14 20:50:15 Slp:         Message:
    2008-10-14 20:50:15 Slp:                 Attempted to perform an unauthorized operation.
    2008-10-14 20:50:15 Slp:         Stack:
    2008-10-14 20:50:15 Slp:                 at Microsoft.SqlServer.Configuration.Sco.InternalRegistryKey.OpenSubKey(String subkey, RegistryAccess requestedAccess)
    2008-10-14 20:50:15 Slp: ----------------------------------------
    2008-10-14 20:50:31 Slp: User has chosen to cancel this action

    Hi,
    I have recently donwloaded the evaluation version of SQL SERVER 2010. I have a similar problem to this user as shown below. I have tried changing the registry permissions for Microsoft SQL Server but this made no difference. Since the registry entries are created by the installation process it seems odd that it cannnot subsequently update the entry.
    Any ideas?
    Dominic
    Detailed results:
      Feature:                       Database Engine Services
      Status:                        Failed: see logs for details
      MSI status:                    Passed
      Configuration status:          Failed: see details below
      Configuration error code:      0xD3BEBD98@1211@1
      Configuration error description: Attempted to perform an unauthorized operation.
      Configuration log:             C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20100408_135119\Detail.txt
    2010-04-08 14:01:43 Slp: ----------------------------------------
    2010-04-08 14:01:43 Slp: The following is an exception stack listing the exceptions in outermost to innermost order
    2010-04-08 14:01:43 Slp: Inner exceptions are being indented
    2010-04-08 14:01:43 Slp:
    2010-04-08 14:01:43 Slp: Exception type: Microsoft.SqlServer.Configuration.Sco.ScoException
    2010-04-08 14:01:43 Slp:     Message:
    2010-04-08 14:01:43 Slp:         Attempted to perform an unauthorized operation.
    2010-04-08 14:01:43 Slp:     Data:
    2010-04-08 14:01:43 Slp:       WatsonData = Microsoft SQL Server
    2010-04-08 14:01:43 Slp:       DisableRetry = true
    2010-04-08 14:01:43 Slp:     Inner exception type: System.UnauthorizedAccessException
    2010-04-08 14:01:43 Slp:         Message:
    2010-04-08 14:01:43 Slp:                 Attempted to perform an unauthorized operation.
    2010-04-08 14:01:43 Slp:         Stack:
    2010-04-08 14:01:43 Slp:                 at System.Security.AccessControl.Win32.GetSecurityInfo(ResourceType resourceType, String name, SafeHandle handle, AccessControlSections accessControlSections, RawSecurityDescriptor& resultSd)
    2010-04-08 14:01:43 Slp:                 at System.Security.AccessControl.NativeObjectSecurity.CreateInternal(ResourceType resourceType, Boolean isContainer, String name, SafeHandle handle, AccessControlSections includeSections, Boolean createByName, ExceptionFromErrorCode exceptionFromErrorCode, Object exceptionContext)
    2010-04-08 14:01:43 Slp:                 at Microsoft.SqlServer.Configuration.Sco.SqlRegistrySecurity..ctor(ResourceType resourceType, SafeRegistryHandle handle, AccessControlSections includeSections)
    2010-04-08 14:01:43 Slp:                 at Microsoft.SqlServer.Configuration.Sco.SqlRegistrySecurity.Create(InternalRegistryKey key)
    2010-04-08 14:01:43 Slp:                 at Microsoft.SqlServer.Configuration.Sco.InternalRegistryKey.SetSecurityDescriptor(String sddl, Boolean overwrite)
    2010-04-08 14:01:43 Slp: ----------------------------------------

  • Change the row colors based on column values in MOSS 2007.

    Hi Team,
    I am using MOSS 2007 environment. In that I am having one SharePoint list. In that list based on column values rows colors need to change.
    Kindly help me anyone on this.
    Thanks,
    Ashok

    Hi Ashok,
    Please follow the below link:
    http://www.contentmaster.com/sharepoint-2010/conditional-formatting-of-list-views-for-sharepoint-2010-changing-the-font-colour/
    http://sharepoint.stackexchange.com/questions/7478/highlight-row-color-based-on-field-values-in-sharepoint-2010-list-view
    Best Regards,
    Brij K

  • Attempted to perform an unauthorized operation sql server 2008 ( Windows 7 )

    Dear All,
    I am facing following error Sql 2008 setup  "Attempted to perform an unauthorized operation sql server 2008 ( Windows 7 )" 
    I tryed to run setup as administrator
    I tryed to run setup to create new user as an administrator and login in new user then run setup
    I tryed to run in compatible mode windows xp sp3.
    I tryed to login in Administrato account and run setup
    in this all time same error came i am tired too much. because of this i format my pc and install windows 7 but still it is same please help me.
    Thanks is advance
    Regards
    Uday
    [email protected]

    Hi,
    Can you locate summary.txt file and details.txt file from location
    C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log
    Upload these to files on some shared location like dropbox, onedrive etc and post link here I would analyze and see where actually problem is coming.
    This link would also help you in searching log files.
    PS: Dont reply to duplicate thread you posted
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
    My Technet Wiki Article
    MVP

  • How to convert rows to columns in sql server 2008

    How to convert rows to columns in sql server 2008 using the GROUP BY function? (only one query allowed)

    Lookup the Pivot transformation. From BOL:
    The Pivot transformation makes a normalized data set into a less normalized
    but more compact version by pivoting the input data on a column value. For
    example, a normalized Orders data set that lists customer name, product, and quantity purchased typically has multiple rows for any customer who purchased multiple products, with each row for that customer showing order
    details for a different product. By pivoting the data set on the product column, the Pivot transformation can output a data set with a
    single row per customer. That single row lists all the purchases by the customer, with the product names shown as column names, and the quantity shown as a value in the product column. Because not every customer purchases every product, many columns may contain
    null values.
    When a dataset is pivoted, input columns perform different roles in the pivoting process. A column can participate in the following ways:
    The column is passed through unchanged to the output. Because many input rows
    can result only in one output row, the transformation copies only the first
    input value for the column.
    The column acts as the key or part of the key that identifies a set of
    records.
    The column defines the pivot. The values in this column are associated with
    columns in the pivoted dataset.
    The column contains values that are placed in the columns that the pivot
    creates.
    Paul

  • "Value cannot be null" error when trying to edit or create Maintenance Plan in SQL Server 2008

    I have SQL Server 2008 installed on Windows Server 2008 64bit, every time I try to open or create a new Maintenance Plan I receive the error:
    Value cannot be null.
    Parameter name: component (System.Design)
    Program Location:
       at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.GetDesigner(IComponent component)
       at Microsoft.DataTransformationServices.VsIntegration.DtsDesignerService.OpenDesigner(String connectionString, Object connection, String objectUrn)
       at Microsoft.SqlServer.Management.DatabaseMaintenance.MaintDesignerMenuHandler.Invoke()
    And in the Design view screen
    "Microsoft SQL Server Management Studio is unable to load this document: Could not load type 'Microsoft.SqlServer.Dts.runtime.Wrapper.IDTSPackageSigning100' from assembly 'Microsoft.SqlServer.DTSRunTimeWrap, Version=10.0.0.0, Culture=neutral'. 
    I have searched for a possible solution and have tried some suggestions of registering the msxml6.dll but and have installed VS2008 SP1 but I'm not in a position where I can do a full reinstall of SQL Server right now. Any help is appreciated. My SQL server
    environment information is below. 
    Microsoft SQL Server Management Studio
    10.0.1600.22 ((SQL_PreRelease).080709-1414 )
    Microsoft Analysis Services Client Tools
    2007.0100.1600.022 ((SQL_PreRelease).080709-1414 )
    Microsoft Data Access Components (MDAC)
    6.0.6002.18005 (lh_sp2rtm.090410-1830)
    Microsoft MSXML 3.0 4.0 5.0 6.0 
    Microsoft Internet Explorer 8.0.6001.18943
    Microsoft .NET Framework 2.0.50727.4206
    Operating System 6.0.6002

    I digged a little deeper and figured out it was a missing directory/file in %TEMP%. Seems some CleaningTool removes all files/directories in %Temp% and after that SSMS was not working any longer. The missing file is actually not needed, but the
    missing directory causes the "Value cannot be null" error.
    My missing file name was:
    C:\Users\<username>\AppData\Local\Temp\2\6vvdaozf.tmp
    But the file name changes on every startup.
    So my missing directory name was:
    C:\Users\<username>\AppData\Local\Temp\2
    After creating a empty directory with the name "2" in %TEMP% all went back to work fine for me.
    I'm not sure the directory name is every time the same, but you can discover your missing file with the process monitor from Sysinternal Tools and filters to "Process Name is ssms.exe" and "Path contains AppData\Local\Temp"
    Hope this helps other people to solve their issues too.
    Thank you!! When I run %temp% it takes me to "C:\Users\Admin ...~\AppData\Local\Temp\some random number". At first the random number was 3, after I logged off and back on it was 2. My temp variable in enviromental variables is correct. I looked on another machine
    running SQL2008 and temp is correct there. If I try to rename the numbered folder SSMS stops working. Any idea?

  • SQL Server 2008 R2 Replication - not applying snapshot and not updating all repliacted columns

    We are using transactional replicating on SQL Server 2008 R2 (SP1) using a remote distributor. We are replicating from BaanLN, which is an ERP application to up to 5 subscribers, all using push publications. 
    Tables can range from a couple million rows to 12 million rows and 100's of GBs in size. 
    And it's due to the size of the tables that it was designed with a one publisher to one table architecture.  
    Until recently it has been working very smooth (last four years)) but we have come across two issues I have never encountered.
    While this has happen a half dozen times before, it last occurred a couple weeks ago when I was adding three new publications, again a one table per publication architecture.
    We use standard SS repl proc calls to create the publications, which have been successful for years. 
    On this occasion replication created the three publications, assigned the subscribers and even generated the new snapshot for all three new publications. 
    However,  while it appeared that replication had created all the publications correctly from end to end, it actually only applied one of the three snapshot and created the new table on both of the new subscribers (two on each of the
    publications).  It only applied the snapshot to one of the two subscribers for the second publications, and did not apply to any on the third.  
    I let it run for three hours to see if it was a back log issue. 
    Replication was showing commands coming across when looking at the sync verification at the publisher and 
    it would even successfully pass a tracer token through each of the three new publications, despite there not being tables on either subscriber on one of the publishers and missing on one of the subscribers on another.  
    I ended up attempting to reinitialize roughly a dozen times, spanning a day, and one of the two remaining publications was correctly reinitialized and the snapshot applied, but the second of the two (failed) again had the same mysterious result, and
    again looked like it was successful based on all the monitoring. 
    So I kept reinitializing the last and after multiple attempts spanning a day, it too finally was built correctly.  
    Now the story only get a little stranger.  We just found out yesterday that on Friday the 17th 
    at 7:45, the approximate time started the aforementioned deployment of the three new publications, 
    we also had three transaction from a stable and vetted publication send over all changes except for a single status column. 
    This publication has 12 million rows and is very active, with thousands of changes daily. 
    , The three rows did not replicate a status change from a 5 to a 6. 
    We verified that the status was in fact 6 on the publisher, and 
    5 on both subscribers, yet no messages or errors.  All the other rows successfully updated.  
    We fixed it by updating the publication from 6 back to 5 then back to 6 again on those specific rows and it worked.
    The CPU is low and overall latency is minimal on the distributor. 
    From all accounts the replication is stable and smooth, but very busy. 
    The issues above have only recently started.  I am not sure where to look for a problem, and to that end, a solution.

    I suspect the problem with the new publication/subscriptions not initializing may have been a result of timeouts but it is hard to say for sure.  The fact that it eventually succeeded after multiple attempts leads me to believe this.  If this happens
    again, enable verbose agent logging for the Distribution Agent to see if you are getting query timeouts.  Add the parameters
    -OutputVerboseLevel 2 -Output C:\TEMP\DistributionAgent.log to the Distribution Agent Run Agent job step, rerun the agent, and collect the log.
    If you are getting query timeouts, try increasing the Distribution Agent -QueryTimeOut parameter.  The default is 1800 seconds.  Try bumping this up to 3600 seconds.
    Regarding the three transactions not replicating, inspect MSrepl_errors in the distribution database for the time these transactions occurred and see if any errors occurred.
    Brandon Williams (blog |
    linkedin)

  • Unable to Load CSV file with comma inside the column(Sql Server 2008)

    Hi,
    I am not able load an CSV file with Comma inside a column. 
    Here is sample File:(First row contain the column names)
    _id,qp,c
    "1","[ ""0"", ""0"", ""0"" ]","helloworld"
    "1","[ ""0"", ""0"", ""0"" ]","helloworld"
    When i specify the Text Qualifier as "(Double quotes) it work in SQL Server 2012, where as fail in the SQL Server 2008, complaining with error:
    TITLE: Microsoft Visual Studio
    The preview sample contains embedded text qualifiers ("). The flat file parser does not support embedding text qualifiers in data. Parsing columns that contain data with text qualifiers will fail at run time.
    BUTTONS:
    OK
    I need to do this in sql server 2008 R2 with Service pack 2, my build version is 10.50.1600.1.
    Can someone let me know it is possible in do the same way it is handle in SQL Server 2012?
    Or
    It got resolved in any successive Cumulative update after 10.50.1600.1?
    Regards Harsh

    Hello,
    If you have CSV with double quotes inside double quotes and with SSIS 2008, I suggest:
    in your data flow you use a script transformation component as Source, then define the ouput columns id signed int, Gp unicode string and C unicode string. e.g. Ouput 0 output colmuns
    Id - four-byte signed
    gp - unicode string
    cc - unicode string
    Do not use a flat file connection, but use a user variable in which you store the name of the flat file (this could be inside a for each file loop).
    The user variable is supplied as a a readonly variable argument to the script component in your dataflow.
    In the script component inMain.CreateNewOutputRows use a System.IO.Streamreader with the user variable name to read the file and use the outputbuffer addrow method to add each line to the output of the script component.
    Between the ReadLine instraction and the addrow instruction you have to add your code to extract the 3 column values.
    public override void CreateNewOutputRows()
    Add rows by calling the AddRow method on the member variable named "<Output Name>Buffer".
    For example, call MyOutputBuffer.AddRow() if your output was named "MyOutput".
    string line;
    System.IO.StreamReader file = new System.IO.StreamReader( Variables.CsvFilename);
    while ((line = file.ReadLine()) != null)
    System.Windows.Forms.MessageBox.Show(line);
    if (line.StartsWith("_id,qp,c") != true) //skip header line
    Output0Buffer.AddRow();
    string[] mydata = Yourlineconversionher(line);
    Output0Buffer.Id = Convert.ToInt32(mydata[0]);
    Output0Buffer.gp = mydata[1];
    Output0Buffer.cc = mydata[2];
    file.Close();
    Jan D'Hondt - SQL server BI development

Maybe you are looking for

  • Custom Search help in Record Working Time

    Hi, We have a requirement to add a custom field on RECORD Working Time ( ESS). This field has been added and custom search help is assigned to the data element of the field. The values in the F4 help should vary based on employees department. The rel

  • Freight charge with tax in sales order

    Hi all my company must implement a particular management of freight charges: in some cases to the customer sales order my company, a part the product cost, add the freight charges (made by a carrier vendor which will send after a vendor invoice to my

  • F.13-clearing, new problem

    HI Gurus I have a situation that I need to clear a GL acct based on the reference field. The items in the documents have a diff of 480$ so I put 500 as my tolerance in config- Define Tolerance Groups for G/L Accounts. The documents I am trying to cle

  • Idoc to file with file name as ABCD timestamp and count

    Hi, Greetings! I have an requirement like iDoc to File and the output file name should be ABCDYYMMDDXX (e.g ABCD14091701) in PI 7.1 where, Default = ABCD YY = year MM = month DD = date XX = sequence no. on the same day; e.g. first batch on same day =

  • What format gives you the best resolution for Home videos to be put on IPAD 2

    I am a new user to the IPAD I want to move some of my Home videos on to the I pad.  What is the best format?  I have sync the same videos to I phone 4 they look great but on the Ipad they are grainy