Quantcast
Channel: SQL Server Data Access forum
Viewing all 4164 articles
Browse latest View live

error occurs while executing oracle procedure (package) using mssql dblink.

$
0
0

Hi

I hava a urgent question~

 When I exectue a Procedure in SQL Server directly to execute oracle proceudre...

  LIKE     

     ..CODING

      EXEC ('BEGIN PKG_GSWM-IF_RECV.PROC-BG30_WMS(); END;') AT DEVDB_LINK   

     CODING...

THERE IS NO ERROR~ IT IS GOOD PROCESSING...

But

When I do it through a web page screen action, I encounter a problem with a message

 " It can't execute procedure at DEVDB_LINK"

I have no idea~

Please help me ..


MDF & LDF file got deleted when ctll C and ctrl V. Not able to recover

$
0
0
MDF & LDF file got deleted when ctll C and ctrl V. Not able to recover

Could someone provide me some advice?

$
0
0

I am a new in SQL Sever and when i connect to SQL Server ,I get an error. Of course , I am not sure how I can solve it but try some ways by researching. Now, the way worked. However , I am not sure the reason why it shows error. 

Could some one show me the cause and provide me some solutions to help me avoid later error?

SQL 2016 - Oracle OLEDB (ODTwithODAC122011) - Cannot Create Instance - Access Denied

$
0
0

Hello All,

Any assistance is appreciated and thank you!

Environment:

   - Host:  Windows 2016 Std.

    - SQL Server: 2016 Ent - 13.0.5479.0

I'm engaged in a Linked Server\ Oracle ODAC battle!

Test connect via UDL

Test connect  OLEDB linked server

SSMS - Execute Query

SELECT

*FROMOPENQUERY(EXADATA,' SELECT SYSDATE FROM DUAL')

The following errors, are raised depending on OLEDB.Oracle provider properties.

Msg 7399, Level 16, State 1, Line 1

The OLE DB provider "OraOLEDB.Oracle" for linked server "EXADATA" reported an error. Access denied.

Msg 7350, Level 16, State 2, Line 1

Cannot get the column information from OLE DB provider "OraOLEDB.Oracle" for linked server "EXADATA".

OR


Mark Covian

SqlParameter with spaces characters in its ParameterName

$
0
0

 

Hi to everybody, I have a little problem.

 

I need that the name of a sqlparameter has a space charater.

 

SqlParameter paremeterEdadReal = newSqlParameter();

paremeterEdadReal.ParameterName = "Edad real";

paremeterEdadReal.Value = 666;

 

 

I tryed this queries:

 

@"INSERT INTO Tabla ([Nombre], [Edad], [Edad real]) VALUES (@Nombre, @Edad, @Edad real)"

 

@"INSERT INTO Tabla ([Nombre], [Edad], [Edad real]) VALUES (@Nombre, @Edad, @[Edad real])"

 

@"INSERT INTO Tabla ([Nombre], [Edad], [Edad real]) VALUES (@Nombre, @Edad, [@Edad real])"

 

 

But I have an exception when I execute this query.

 

Somebody could help me please?

 

Thanks in advance Smile

OBDC connection to SQL Server using IP address

$
0
0

Hi,

My client insists I establish an ODBC connection to SQL Server using SERVER=IPaddress in the connection string, when developing an Access interface using linked tables. I have been able to set up a User DSN via ODBC Administrator, setting the SERVER=IPaddress.

However what if the computer's IP address is Dynamic and therefore can change? Then the connection will fail, is that correct?

Is it possible to automatically reset the DSN Server IPaddress?

Another question is: why can't I set the SERVER=IP (Gateway) address to connect to the Server?

I hope this question is clear enough.

I am afraid that although I am competent with VBA, I know very little about networks, TCP/IP etc

Thank you

D V Knight


Jadar17

rewritebatchedstatements parameter is not working

$
0
0

Hi, 
As part of performances story, we have made batch inserts instead of single inserts in our java code.

Please find Sample code code:

String myConnectionString ="jdbc:sqlserver://mbaastest18.konylabs.net:1433;databasename=TOMCATmfreportsdbSINGLEX56";try(Connection con =DriverManager.getConnection(myConnectionString,"root","whatever")){try(PreparedStatement ps = con.prepareStatement("INSERT INTO jdbc (`name`) VALUES (?)")){for(int i =1; i <=5; i++){
            ps.setString(1,String.format("Line %d: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
                    i));
            ps.addBatch();}
        ps.executeBatch();}}

But the real problem is insertion is happening like below

INSERT INTO jdbc (`name`) VALUES ('Line 1: Lorem ipsum ...')
INSERT INTO jdbc (`name`) VALUES ('Line 2: Lorem ipsum ...')

But I need something like below. So, I tried attaching rewritebatchedstatements parameter to the connection url,it worked for mysql but not working sql server.

INSERTINTO jdbc (`name`)VALUES('Line 1: Lorem ipsum ...'),('Line 2: Lorem ipsum ...')

Is there any way to make it work?

I have read about bulk copy command, but currently we cannot afford to use it.
Any help would be appreciated. 

sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x2746

$
0
0

Hi,

i freshly installed Ubuntu Server 18.04 TLS with MS SQL Server 17 on Ubuntu. After all steps i try to execute on the localhost the command: sqlcmd -S localhost -U sa

and get the upper error. I google a little bit and find out that the TLS 1.2 maybe is the issue.

So i try the command: openssl s_client -connect google.com:443 -tlsl_2
and get a handshake and verification OK

what can i try next to solve this issue?

kindly regards, Lars


want to show SQL Table data in WebURL

$
0
0

Hi Experts,

would like to show table data in WebURL without using MDS/SSRS/PowerBi. is there a way to do it.

Thanks,

Dileep


ADKR

(MS DTC) has cancelled the distributed transaction.

$
0
0

The Microsoft distributed transaction coordinator (MS DTC) has cancelled the distributed transaction. kindly provide a solution.

sql server error code 3417 after power outage

$
0
0

After a power outage and a system (Windows Server 2016) reboot. SQL Server 2017 failed to start. Received a message that said:

Windows could not start SQL Server on Local Computer. For more information see event log... refer to services-specific error code 3417.

The Log file: The log scan number (15216:123:0) passed to log scan in database 'master' is not valid. This error may indicate data corruption or that the log file (.ldf) does not match the data file (.mdf). If this error occurred during replication, re-create the publication. Otherwise, restore from backup if the problem results in a failure during startup.

The Application Event: The log scan number (15216:123:0) passed to log scan in database 'master' is not valid. This error may indicate data corruption or that the log file (.ldf) does not match the data file (.mdf). If this error occurred during replication, re-create the publication. Otherwise, restore from backup if the problem results in a failure during startup.

Can anyone tell me what I need to do in order for SQL Server to start working again?


MY SQL

$
0
0

   How do i know which SQL i have? I AM running a ACER PREDATOR , WINDOWS 10 , LAPTOP


ron duncan

Remote Desktop Services - HA Broker setup = connection string

$
0
0

Hi

I'm trying to setup my RDS Broker with high availability.  It's a basic setup and just for a proof of concept.

2 x brokers with the other roles installed an SQL 2017

2 x hosts

When i try to setup the Broker HA no connection string works.  I have google endless varients.  I have tried the UDL file option, change to text, grab config etc but nothing.  It either moans about window authentication or says the database isnt reachable.

However my understanding is that the dedicated SQL server option CREATES the database so it complaining it can't access one seems odd.

Could anyone offer any advice? The brokers are in an AD group and setup as a user in SQL, the SQL tools are all installed and when i test the connection via a UDL file it connects perfectly.

Soap Web Service Not Working With WINDOWS SERVER 2012 & SQL SERVER 2012.

$
0
0

I hope someone can assist.

I am trying download a hotfix for server 2012 to solve the SOAP issue I have, when I execute code that works perfectly on other OS versions on SERVER 2012 it fails with: 0x80070057 The parameter is incorrect. Send failed POST.

I download the hotfix for 2012 here, but it does not install on my server and states incompatible. 

https://support.microsoft.com/en-us/help/2968741/error-0x80070057-when-sql-server-communicates-to-a-web-server-using-st 

I have tried changing the TSQL a little on my SP's but to no avail, found that here: 

https://www.ryadel.com/en/msxml2-xmlhttp-serverxmlhttp-error-0x80070057-parameter-incorrect-post-http-request-t-sql-server-2008-2012-sp-fix/

I have also tired using the following, they all present errors:

--WinHttp.WinHttpRequest.5.1
--MSXML2.ServerXMLHTTP
--MSXML2.ServerXMLHTTP.4.0
--MSXML2.ServerXMLHTTP.3.0
EXEC @hResult = sp_OACreate 'MSXML2.ServerXMLHTTP.3.0', @objectID OUT

The supposed working TSQL change that did not work: 

----OLD METHOD
--DECLARE @parms AS varchar(3000) = 'p1=a&p2=b&p3=c';
----EXEC @result = sp_OAMethod @obj, 'send', NULL, @parms;

----NEW METOHD
--DECLARE @parms AS varchar(3000) = 'p1=a&p2=b&p3=c';
--DECLARE @send NVARCHAR(4000) = 'send("' + REPLACE(@parms, '"', '''') + '")';
----EXEC @result = sp_OAMethod @obj, @send;

I have sorted out one of our 2012 servers by copying the msxml3.dll and msxml6.dll from another 2008 server, but doing to same does not work on this server, I need the correct dll's to succeed. 

Any suggestions please.

Thank you, help is appreciated.



XA Transactions failing with SQLJDBC_XA DTC_ERROR Context: FInitializeTransactionManager

$
0
0

Hi,

I'm seeing an inconsistent problem with the JDBC driver and XA transactions.

I think the problem is derived from the fact I have multiple J2SE applications running on the same server and connecting to the same DB.

I'm using the latest JDBC drivers and I followed the MS instrutions on configuring the MSSQL-Server, including applying the XP-hotfix as my server is windows XP-SP3. My Transaction manager is Atomikos Essential Transactions. My SQL-Server is 2008.

This is part of the logs which atomikos generates:

10-11-23 09:16:05,275 [main] a SessionHandleState with 1 context(s): checking XA context for transaction com.atomikos.icatch.imp.CompositeTransactionImp@635d2874
10-11-23 09:16:05,291 [main] Coordinator 192.168.0.198.tm0000100001 entering state: ACTIVE
10-11-23 09:16:05,291 [main] Coordinator 192.168.0.198.tm0000100001 entered state: ACTIVE
10-11-23 09:16:05,291 [main] addParticipant ( XAResourceTransaction: 3139322E3136382E302E3139382E746D30303030313030303031:3139322E3136382E302E3139382E746D31 ) for transaction 192.168.0.198.tm0000100001
10-11-23 09:16:05,291 [main] XAResourceTransaction: 3139322E3136382E302E3139382E746D30303030313030303031:3139322E3136382E302E3139382E746D31: about to switch to XAResource XAResourceID:1
10-11-23 09:16:05,291 [main] XAResourceTransaction 192.168.0.198.tm0000100001192.168.0.198.tm1: switched to XAResource XAResourceID:1
10-11-23 09:16:05,291 [main] XAResource.start ( 3139322E3136382E302E3139382E746D30303030313030303031:3139322E3136382E302E3139382E746D31 , XAResource.TMNOFLAGS ) on resource java:comp/env/jdbc/dataSource represented by XAResource instance XAResourceID:1
10-11-23 09:16:07,728 [main] XA resource 'java:comp/env/jdbc/dataSource': resume for XID '3139322E3136382E302E3139382E746D30303030313030303031:3139322E3136382E302E3139382E746D31' raised -3: the XA resource detected an internal error
javax.transaction.xa.XAException: Function START: failed, status: -3. The error message is: *** SQLJDBC_XA DTC_ERROR Context: FInitializeTransactionManager, state=1, StatusCode:-3 (0xFFFFFFFD) ***.
	at com.microsoft.sqlserver.jdbc.SQLServerXAResource.DTC_XA_Interface(SQLServerXAResource.java:543)
	at com.microsoft.sqlserver.jdbc.SQLServerXAResource.start(SQLServerXAResource.java:672)
	at com.atomikos.datasource.xa.XAResourceTransaction.resume(XAResourceTransaction.java:476)
	at com.atomikos.datasource.xa.session.BranchEnlistedStateHandler.<init>(BranchEnlistedStateHandler.java:57)
	at com.atomikos.datasource.xa.session.NotInBranchStateHandler.checkEnlistBeforeUse(NotInBranchStateHandler.java:66)
	at com.atomikos.datasource.xa.session.TransactionContext.checkEnlistBeforeUse(TransactionContext.java:85)
	at com.atomikos.datasource.xa.session.SessionHandleState.notifyBeforeUse(SessionHandleState.java:176)
	at com.atomikos.jdbc.AtomikosConnectionProxy.enlist(AtomikosConnectionProxy.java:197)
	at com.atomikos.jdbc.AtomikosConnectionProxy.invoke(AtomikosConnectionProxy.java:131)
	at $Proxy11.prepareStatement(Unknown Source)
	at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
	at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
	at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
	at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1573)
	at org.hibernate.loader.Loader.doQuery(Loader.java:696)
	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
	at org.hibernate.loader.Loader.doList(Loader.java:2228)
	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
	at org.hibernate.loader.Loader.list(Loader.java:2120)
	at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
	at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361)
	at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148)
	at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
	at com.myCompany.dal.hibernate.BaseHibernateDAO.findByProperty(BaseHibernateDAO.java:94)
	at com.myCompany.dal.DAO.ConfigurationDAO.findByServer(ConfigurationDAO.java:33)
	at com.myCompany.common.Config.LoadDBConfiuration(Config.java:70)
	at com.myCompany.common.Config.init(Config.java:56)
	at com.myCompany.myModule.myModule.main(myModule.java:52)
10-11-23 09:16:07,744 [main] Error enlisting in transaction - connection might be broken? Please check the logs for more information...
com.atomikos.datasource.ResourceException: XA resource 'java:comp/env/jdbc/dataSource': resume for XID '3139322E3136382E302E3139382E746D30303030313030303031:3139322E3136382E302E3139382E746D31' raised -3: the XA resource detected an internal error
	at com.atomikos.datasource.xa.XAResourceTransaction.resume(XAResourceTransaction.java:483)
	at com.atomikos.datasource.xa.session.BranchEnlistedStateHandler.<init>(BranchEnlistedStateHandler.java:57)
	at com.atomikos.datasource.xa.session.NotInBranchStateHandler.checkEnlistBeforeUse(NotInBranchStateHandler.java:66)
	at com.atomikos.datasource.xa.session.TransactionContext.checkEnlistBeforeUse(TransactionContext.java:85)
	at com.atomikos.datasource.xa.session.SessionHandleState.notifyBeforeUse(SessionHandleState.java:176)
	at com.atomikos.jdbc.AtomikosConnectionProxy.enlist(AtomikosConnectionProxy.java:197)
	at com.atomikos.jdbc.AtomikosConnectionProxy.invoke(AtomikosConnectionProxy.java:131)
	at $Proxy11.prepareStatement(Unknown Source)
	at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
	at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
	at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
	at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1573)
	at org.hibernate.loader.Loader.doQuery(Loader.java:696)
	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
	at org.hibernate.loader.Loader.doList(Loader.java:2228)
	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
	at org.hibernate.loader.Loader.list(Loader.java:2120)
	at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
	at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361)
	at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148)
	at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
	at com.myCompany.dal.hibernate.BaseHibernateDAO.findByProperty(BaseHibernateDAO.java:94)
	at com.myCompany.dal.DAO.ConfigurationDAO.findByServer(ConfigurationDAO.java:33)
	at com.myCompany.common.Config.LoadDBConfiuration(Config.java:70)
	at com.myCompany.common.Config.init(Config.java:56)
	at com.myCompany.myModule.myModule.main(myModule.java:52)
10-11-23 09:16:07,744 [main] getCompositeTransaction() returning instance with id 192.168.0.198.tm0000100001
10-11-23 09:16:07,744 [main] getCompositeTransaction() returning instance with id 192.168.0.198.tm0000100001
10-11-23 09:16:07,806 [main] getCompositeTransaction() returning instance with id 192.168.0.198.tm0000100001
10-11-23 09:16:07,806 [main] getCompositeTransaction() returning instance with id 192.168.0.198.tm0000100001
10-11-23 09:16:07,822 [main] commit() done (by application) of transaction 192.168.0.198.tm0000100001
10-11-23 09:16:07,822 [main] Coordinator 192.168.0.198.tm0000100001 entering state: PREPARING
10-11-23 09:16:07,822 [main] Coordinator 192.168.0.198.tm0000100001 entered state: PREPARING
10-11-23 09:16:07,822 [main] (1.5) executing task: com.atomikos.icatch.imp.Propagator$PropagatorThread@602b6b
10-11-23 09:16:07,822 [main] ThreadFactory: creating new thread: Atomikos:2
10-11-23 09:16:07,822 [main] (1.5) executing task: com.atomikos.icatch.imp.Propagator$PropagatorThread@3e1bc8
10-11-23 09:16:07,822 [main] ThreadFactory: creating new thread: Atomikos:3
10-11-23 09:16:07,822 [Atomikos:3] XAResource.end ( 3139322E3136382E302E3139382E746D30303030313030303031:3139322E3136382E302E3139382E746D31 , XAResource.TMSUCCESS ) on resource java:comp/env/jdbc/dataSource represented by XAResource instance XAResourceID:1
10-11-23 09:16:09,900 [Atomikos:3] XA resource 'java:comp/env/jdbc/dataSource': end for XID '3139322E3136382E302E3139382E746D30303030313030303031:3139322E3136382E302E3139382E746D31' raised -7: the XA resource has become unavailable
javax.transaction.xa.XAException: Function END: failed, status: -7. The error message is: *** SQLJDBC_XA DTC_ERROR Context: xa_end, state=1, StatusCode:-7 (0xFFFFFFF9) ***.
	at com.microsoft.sqlserver.jdbc.SQLServerXAResource.DTC_XA_Interface(SQLServerXAResource.java:543)
	at com.microsoft.sqlserver.jdbc.SQLServerXAResource.end(SQLServerXAResource.java:685)
	at com.atomikos.datasource.xa.XAResourceTransaction.suspend(XAResourceTransaction.java:440)
	at com.atomikos.datasource.xa.XAResourceTransaction.prepare(XAResourceTransaction.java:591)
	at com.atomikos.icatch.imp.PrepareMessage.send(PrepareMessage.java:61)
	at com.atomikos.icatch.imp.PropagationMessage.submit(PropagationMessage.java:111)
	at com.atomikos.icatch.imp.Propagator$PropagatorThread.run(Propagator.java:87)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
10-11-23 09:16:09,900 [main] Coordinator 192.168.0.198.tm0000100001 entering state: ABORTING
10-11-23 09:16:09,900 [main] Coordinator 192.168.0.198.tm0000100001 entered state: ABORTING
10-11-23 09:16:09,900 [main] (1.5) executing task: com.atomikos.icatch.imp.Propagator$PropagatorThread@13b9fae
10-11-23 09:16:09,900 [main] Coordinator 192.168.0.198.tm0000100001 entering state: TERMINATED
10-11-23 09:16:09,900 [main] Coordinator 192.168.0.198.tm0000100001 : stopping timer...
10-11-23 09:16:09,900 [main] Coordinator 192.168.0.198.tm0000100001 : disposing statehandler TERMINATED...
10-11-23 09:16:09,900 [main] Coordinator 192.168.0.198.tm0000100001 : disposed.

If you have any questions please don't hesitate to ask.

I'd appreciate any help granted,

Ittai


SQL Server 2012 xxx.msi has changed since it was initially published

$
0
0

Hi.

I have a project created with Visual Studio 2017 and SQL Server 2012. The application installer is done with the Visual Studio Publisher.

This installer worked very well with our clients until the following message began to appear when trying to install the SQL:



We thought it was a mistake on our part but when trying installers that worked before, they gave the same problem.

Obviously the solution is to search and download the xx.msi file (I say xxx because sometimes after installing one, when trying to install my app again, the error happens again with another msi file.), but it is something additional that is a nuisance for many users.

In my opinion, Microsoft changed the path where the xxx.msi files is and that is why our installer cannot download those additional ones.

Although the image is from Win7, it also happens with Win 10.

Is there any solution for this problem?

Any comments or suggestions are welcome

I need help with this

$
0
0

Please take a look at this and tell me if there is something wrong. I can´t find where is the problem but this sp is not working.

USE [DB_Canales]
GO
/****** Object:  StoredProcedure [dbo].[SP_CargaBaseCanales_3]    Script Date: 11-10-2019 12:20:51 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================================================================================
-- Author:<Sebastian Carreño>
-- Create date: <Create Date,,>
-- Description:<Description,,>
-- 2019-09-02: Se cambia busqueda de los recibos tecnocom, se busca el último recibo generado para la cuenta
-- 2019-09-03: Se incorpora la busqueda del ultimo EECC para nexus, de forma de actualizar lo ultimo facturado, si corresponde
-- EXEC SP_CargaBaseCanales_3 
-- ============================================================================================================
ALTER PROCEDURE [dbo].[SP_CargaBaseCanales_3]

AS
BEGIN

DECLARE 
@FEchaActual int,
@FechaVencimeinto  int

DECLARE @NombreSP VARCHAR(50) = 'SP_CargaBaseCanales_3'

--LOG
INSERT INTO DB_Canales.dbo.TBL_LOG VALUES (@NombreSP, GETDATE(), NULL, '01.0. MAX Fechas EECC NEXUS')


SET @FEchaActual = (SELECTMAX(FechaFactActual)
FROMPRODAPPS108.DMSMUCorp.DBO.HIST_EECCE_HrCtaNac_NEXUSTC NEXUSTC with (nolock))
 
 SET @FechaVencimeinto = (SELECT MAX(FechaProceso) 
FROM PRODAPPS108.DMSMUCorp.DBO.HIST_EECCE_DetTransNac_NEXUSTC Cuenta with (nolock))


--LOG
INSERT INTO DB_Canales.dbo.TBL_LOG VALUES (@NombreSP, GETDATE(), NULL, '02.0. MERGE Tbl_hist_Estado_Cuenta NEXUS')

--#################################################################################################
--############################Cargamos la Infromacion de Hist Estado Cuenta #######################
--#################################################################################################

MERGE DB_Canales.dbo.Tbl_hist_Estado_Cuenta AS TARGET
USING (SELECT top 10
            NEXUSTC.SaldoCapitalCuotas AS SaldoCapitalCuotas,
NEXUSTC.PagoMinPesos AS PagoMinPesos ,
NEXUSTC.TasaIntCuotas5_24 AS TasaIntCuotas5_24,
TasaIntProxPeriodo AS TasaIntProxPeriodo,
NEXUSTC.CuotaMes1 AS CuotaMes1,
NEXUSTC.CuotaMes2 AS CuotaMes2,
NEXUSTC.CuotaMes3 AS CuotaMes3,
NEXUSTC.CuotaMes4 AS CuotaMes4,
Convert(BIGINT,NEXUSTC.[Saldo anterior]) AS SaldoAnterior,
Convert(BIGINT,NEXUSTC.TotalPagos) as TotalPagos,
NEXUSTC.TotalComprasCuotasAvan AS TotalComprasCuotasAvan,
NEXUSTC.TotalCargosAbonosCta AS TotalCargosAbonosCta,
Convert(date, Convert(varchar(10),FechaFactActual, 112)) as FECHAFACTURACION,
Convert(date, Convert(varchar(10),NEXUSTC.FechaFactProxima, 112)) AS FecProxima,
Convert(date, Convert(varchar(10),NEXUSTC.FechaProceso,112)) As Fechaultimafacturacion,
case when NEXUSTC.FechaFactVencimiento = 0 then
              (select top 1 fechavencimiento from DB_Canales.dbo.CALENDARIO_FACTURACION)
            else Convert(date, Convert(varchar(10),NEXUSTC.FechaFactVencimiento,112))
              end as FechaFactVencimiento,
NEXUSTC.NumCuenta as NumCuenta,
FechaFactActual,
cuenta.rut
FROM PRODAPPS108.DMSMUCorp.DBO.HIST_EECCE_HrCtaNac_NEXUSTC NEXUSTC with (nolock)
inner join ( select numcuenta, max(fechaproceso)  fechaproceso
FROM PRODAPPS108.DMSMUCorp.DBO.HIST_EECCE_HrCtaNac_NEXUSTC a with (nolock)  
group by numcuenta
) UEECC
on  NEXUSTC.numcuenta = UEECC.numcuenta
and NEXUSTC.fechaproceso = UEECC.fechaproceso
INNER JOIN [DB_CANALES].[dbo].[Tbl_Cuenta] CUENTA WITH(NOLOCK)
ONCUENTA.IdNumerocuenta = NEXUSTC.NUMCUENTA where 
) AS SOURCE 
ON (TARGET.idnumerocuenta = SOURCE.NUMCUENTA
AND TARGET.FechaVencimiento  =   Convert(date, Convert(varchar(10),SOURCE.FechaFactActual, 112))
   )

WHEN MATCHED AND 
(ISNULL(TARGET.SaldoCapitalCuotas,0) <> ISNULL(SOURCE.SaldoCapitalCuotas,0)
ORISNULL(TARGET.PagoMinimo,0) <> ISNULL(SOURCE.PagoMinPesos,0)
ORISNULL(TARGET.ComprasCuoptas,0) <> ISNULL(SOURCE.TasaIntCuotas5_24,0)
ORISNULL(TARGET.ComprasCuotas5a24,0) <> ISNULL(SOURCE.TasaIntProxPeriodo,0)
ORISNULL(TARGET.CuotaPrimerMes,0) <> ISNULL(SOURCE.CuotaMes1,0)
ORISNULL(TARGET.CuotaSegundoMes,0) <> ISNULL(SOURCE.CuotaMes2,0)
ORISNULL(TARGET.CuotaTercerMes,0) <> ISNULL(SOURCE.CuotaMes3,0)
ORISNULL(TARGET.CuotaCuartoMes,0) <> ISNULL(SOURCE.CuotaMes4,0)
ORISNULL(TARGET.MontoSaldoAnterior,0) <> ISNULL(SOURCE.SaldoAnterior,0)
ORISNULL(TARGET.TotalDePagos,0)<> ISNULL(SOURCE.TotalPagos,0)
ORISNULL(TARGET.TotalCargosAutCuenta,0) <> ISNULL(SOURCE.TotalComprasCuotasAvan,0)
ORISNULL(TARGET.TotalCargosyAbonosCuenta,0) <> ISNULL(SOURCE.TotalCargosAbonosCta,0)
ORISNULL(TARGET.FechaVencimiento,'?') <> ISNULL(SOURCE.FECHAFACTURACION,'?')
ORISNULL(TARGET.FechaProxFacturacion,'?') <> ISNULL(SOURCE.FecProxima,'?')
ORISNULL(TARGET.FechaUltimaFacturacion,'?') <> ISNULL(SOURCE.Fechaultimafacturacion,'?')
)
THEN 
UPDATE SET 
TARGET.SaldoCapitalCuotas = SOURCE.SaldoCapitalCuotas ,
TARGET.PagoMinimo = SOURCE.PagoMinPesos,
TARGET.ComprasCuoptas = SOURCE.TasaIntCuotas5_24,
TARGET.ComprasCuotas5a24 = SOURCE.TasaIntProxPeriodo,
TARGET.CuotaPrimerMes = SOURCE.CuotaMes1 ,
TARGET.CuotaSegundoMes = SOURCE.CuotaMes2,
TARGET.CuotaTercerMes = SOURCE.CuotaMes3,
TARGET.CuotaCuartoMes = SOURCE.CuotaMes4,
TARGET.MontoSaldoAnterior = SOURCE.SaldoAnterior,
TARGET.TotalDePagos= SOURCE.TotalPagos,
TARGET.TotalCargosAutCuenta = SOURCE.TotalComprasCuotasAvan,
TARGET.TotalCargosyAbonosCuenta = SOURCE.TotalCargosAbonosCta,
TARGET.FechaVencimiento = SOURCE.FECHAFACTURACION,
TARGET.FechaProxFacturacion = SOURCE.FecProxima,
TARGET.FechaUltimaFacturacion = SOURCE.Fechaultimafacturacion,
TARGET.FechaPrimerVtoAvanceCIota = SOURCE.FechaFactVencimiento 
WHEN NOT MATCHED  BY TARGET THEN

INSERT (
SaldoCapitalCuotas, PagoMinimo,
ComprasCuoptas, ComprasCuotas5a24,
CuotaPrimerMes, CuotaSegundoMes,
CuotaTercerMes, CuotaCuartoMes,
MontoSaldoAnterior, TotalDePagos,
TotalCargosAutCuenta, TotalCargosyAbonosCuenta,
FechaVencimiento, FechaProxFacturacion,
FechaUltimaFacturacion, FechaPrimerVtoAvanceCIota,
IdNumeroCuenta          , rut,
idorigen


VALUES (SOURCE.SaldoCapitalCuotas,SOURCE.PagoMinPesos,
SOURCE.TasaIntCuotas5_24,SOURCE.TasaIntProxPeriodo,
SOURCE.CuotaMes1,SOURCE.CuotaMes2,
SOURCE.CuotaMes3,SOURCE.CuotaMes4,
SOURCE.SaldoAnterior,SOURCE.TotalPagos,
SOURCE.TotalComprasCuotasAvan,SOURCE.TotalCargosAbonosCta,
SOURCE.FECHAFACTURACION,SOURCE.FecProxima ,
SOURCE.Fechaultimafacturacion, SOURCE.FechaFactVencimiento,
SOURCE.NUMCUENTA,
SOURCE.rut,
1
);
--------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------
DECLARE @FEchaActualTecno Date

--LOG
INSERT INTO DB_Canales.dbo.TBL_LOG VALUES (@NombreSP, GETDATE(), NULL, '03.0. MERGE Tbl_hist_Estado_Cuenta SAT')


SET @FEchaActualTecno = (SELECTMAX(Fecha_proceso)
FROMPRODAPPS108.BDSAT.ITFGEN.HIST_RECIBOS Tecno with (nolock) 
        )

MERGE DB_Canales.dbo.Tbl_hist_Estado_Cuenta AS TARGET
USING (SELECT RICIBO.CUENTA AS NUMCUENTA,
IMPREC AS FACTURADO,
IMPMIN AS PAGOMIN,
IMPAPL AS PAGADPO,
FECEMIMOV as Fechaultimafacturacion,
FECVENMOV AS FECHAVEN,
CUEN.LIMCRECTA1 - CUEN.SALDISCRE1 -CUEN.SALAUTCREC1 SALDO,
cta.rut
FROM ( SELECT REC.CODENT, REC.CENTALTA, REC.CUENTA, REC.NUMEXTCTA, REC.SITUAREC, REC.FECEMIMOV, 
   REC.FECVENMOV, REC.IMPREC - REC.IMPAPL AS IMPREC, REC.IMPMIN, REC.IMPAPL
FROM PRODAPPS108.BDSAT.ITFGEN.HIST_RECIBOS REC
INNER JOIN (SELECT CODENT, CENTALTA, CUENTA, MAX(NUMEXTCTA) NUMEXTCTA
FROM PRODAPPS108.BDSAT.ITFGEN.HIST_RECIBOS
WHERE FECHA_PROCESO = @FEchaActualTecno
GROUP BY CODENT, CENTALTA, CUENTA
   ) ULTREC
ON  REC.CODENT = ULTREC.CODENT
AND REC.CENTALTA = ULTREC.CENTALTA
AND REC.CUENTA = ULTREC.CUENTA
AND REC.NUMEXTCTA = ULTREC.NUMEXTCTA
WHERE REC.Fecha_Proceso = @FEchaActualTecno
) RICIBO
INNER JOIN PRODAPPS108.BDSAT.[dbo].[HIST_CUENTAS] CUEN
ON RICIBO.CODENT = CUEN.CODENT
AND RICIBO.CENTALTA = CUEN.CENALTA
AND RICIBO.CUENTA = CUEN.CUENTA
AND CUEN.FECHA_PROCESO >= @FEchaActualTecno
inner join db_canales.dbo.tbl_cuenta CTA 
ON CTA.IdNumeroCuenta = RICIBO.CUENTA
      ) AS SOURCE 
ON ( TARGET.idnumerocuenta = SOURCE.NUMCUENTA
AND TARGET.FechaVencimiento  =   Convert(date, Convert(varchar(10),SOURCE.FECHAVEN, 112))
   )
WHEN MATCHED AND 
(   ISNULL(TARGET.SaldoCapitalCuotas,0) <> ISNULL(SOURCE.SALDO,0)
OR ISNULL(TARGET.PagoMinimo,0) <> ISNULL(SOURCE.PAGOMIN,0)
OR ISNULL(TARGET.FechaVencimiento,'1900-01-01') <> SOURCE.FECHAVEN
OR ISNULL(TARGET.Fechaultimafacturacion, '1900-01-01') <> SOURCE.Fechaultimafacturacion
OR ISNULL(TARGET.FechaPrimerVtoAvanceCIota,'1900-01-01') <> SOURCE.FECHAVEN  
OR (isnull(TotalDePagos,0)  <> SOURCE.PAGADPO)

THEN
UPDATE SET 
TARGET.SaldoCapitalCuotas= SOURCE.SALDO ,
TARGET.PagoMinimo= SOURCE.PAGOMIN,
TARGET.FechaVencimiento= SOURCE.FECHAVEN,
TARGET.FechaPrimerVtoAvanceCIota= SOURCE.FECHAVEN,  
TARGET.Fechaultimafacturacion= SOURCE.Fechaultimafacturacion,
TARGET.TotalDePagos                 = SOURCE.PAGADPO
WHEN NOT MATCHED  BY TARGET THEN
 INSERT (SaldoCapitalCuotas,PagoMinimo,
TotalDePagos,
FechaVencimiento,
FechaUltimaFacturacion,
IdNumeroCuenta,
rut,
idorigen

VALUES (SOURCE.SALDO ,SOURCE.PAGOMIN,
SOURCE.PAGADPO,
SOURCE.FECHAVEN,
SOURCE.Fechaultimafacturacion,
SOURCE.NUMCUENTA,
source.rut,
2
);

--#################################################################################################
--######################### Cargamos la Infromacion de Hist_Movimientos_Cuenta ####################
--#################################################################################################

--LOG
INSERT INTO DB_Canales.dbo.TBL_LOG VALUES (@NombreSP, GETDATE(), NULL, '04.0. MERGE Tbl_Movimiento_Cuenta NEXUS')


MERGE DB_Canales.dbo.Tbl_Movimiento_Cuenta  AS TARGET
USING 
(SELECT Convert(date,Convert(varchar(10),FechaProceso,112)) AS FechaProceso,
Cuenta.ComercioNombre AS ComercioNombre ,
TransaccionMonto AS  TransaccionMonto,
Cuenta.SegmentoTXS AS SegmentoTXS ,
Cuenta.Correlativo AS  Correlativo,
TransaccionCodigo AS TransaccionCodigo,
HISTCuenta.IdEstadoCuenta AS IdEstadoCuenta
FROM    PRODAPPS108.DMSMUCorp.DBO.HIST_EECCE_DetTransNac_NEXUSTC Cuenta with (nolock)
INNER JOIN  DB_Canales.dbo.Tbl_hist_Estado_Cuenta HISTCuenta with (nolock)
ON HISTCuenta.IdNumeroCuenta = Cuenta.NUmCuenta
WHERE FechaProceso = convert(varchar(10),@FechaVencimeinto,112) -- Between convert(varchar(10), getdate()-2 ,112) AND convert(varchar(10), getdate()-1 ,112) 
GROUP BY FechaProceso, Cuenta.ComercioNombre, TransaccionMonto,Cuenta.SegmentoTXS,Cuenta.Correlativo,TransaccionCodigo,HISTCuenta.IdEstadoCuenta
) AS SOURCE 
ON ( TARGET.IdEstadoCuenta  = SOURCE.IdEstadoCuenta )

WHEN NOT MATCHED  BY TARGET THEN
INSERT (Fecha,
ComercioNombre,
Monto,
Segmento,
Correlativo,
CodTransaccion,
IdEstadoCuenta) 
VALUES (SOURCE.FechaProceso,SOURCE.ComercioNombre, 
SOURCE.TransaccionMonto,SOURCE.SegmentoTXS , SOURCE.Correlativo, 
SOURCE.TransaccionCodigo, SOURCE.IdEstadoCuenta 
);

------------------------------------------------------------------
------------------------------------------------------------------

--LOG
INSERT INTO DB_Canales.dbo.TBL_LOG VALUES (@NombreSP, GETDATE(), NULL, '05.0. MERGE Tbl_Movimiento_Cuenta SAT')

MERGE DB_Canales.dbo.Tbl_Movimiento_Cuenta  AS TARGET
USING (SELECT  FECFAC AS FechaProceso,
OPER.CUENTA ,
NOMCOMRED AS ComercioNombre ,
IMPDIV AS TransaccionMonto ,
1 AS SegmentoTXS ,
NUMORDEN Correlativo  ,
NUMAUT TransaccionCodigo ,
IdEstadoCuenta AS IdEstadoCuenta 
FROM PRODAPPS108.BDSAT.OperacionesDiarias.HIST_MOVIMIENTOS_DE_CREDITO OPER
INNER JOIN DB_Canales.dbo.Tbl_hist_Estado_Cuenta HistCuenta
ON OPER.CUENTA = HistCuenta.IdNumeroCuenta 
where FECHA_PROCESO =   CONVERT(VARCHAR(10),GETDATE()-1,120)
  ) AS SOURCE 
ON (TARGET.IdEstadoCuenta  = SOURCE.IdEstadoCuenta)

WHEN NOT MATCHED  BY TARGET THEN
 INSERT (Fecha,
ComercioNombre,
Monto,
Segmento,
Correlativo,
CodTransaccion,
IdEstadoCuenta) 
VALUES (SOURCE.FechaProceso,SOURCE.ComercioNombre, 
SOURCE.TransaccionMonto,SOURCE.SegmentoTXS , SOURCE.Correlativo, 
SOURCE.TransaccionCodigo, SOURCE.IdEstadoCuenta 
);

END


--LOG
INSERT INTO DB_Canales.dbo.TBL_LOG VALUES (@NombreSP, GETDATE(), NULL, '06.0. FIN')


GO

Executed as user: NT SERVICE\SQLSERVERAGENT. Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)". [SQLSTATE 42000] (Error 7303) OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(n

$
0
0

hello,

i'm new so please explain in details i'm not "system guy nor dba"

i entered to sql with admin privilege created job to run procedure - the procedure by itself work fine but when using the job it's fail with the reason above

thanks in advanced for any help


WINDOWS

$
0
0
 I WENT TO WEB-PAGE ABOUT ERROR'S IN WINDOWS PATH, PARAMETERS ..CANT FIND AND CANT FIND MY ACCOUNT

CINDY

sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x2746

$
0
0

Hi pals,

I can access this SQL server with Ubuntu mssql-tools, but it cannot access with Debian 10 by the instruction as follows:
sqlcmd -S <IP> -U <User> -P <Password>

And always get the error message:

Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x2746.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Client unable to establish connection.

There are some posts point out that might be caused by the OpenSSL version, but the version in Debain are the same with in Ubuntu.
Is there any way to fix this issue?

Ubuntu Client info:

Ubuntu 18.04.3 LTS(Ubuntu 7.3.0-16ubuntu3)
OpenSSL 1.1.1  11 Sep 2018
Sqlcmd Version 17.4.0001.1 Linux

Debian Client info:

Debian GNU/Linux 10 (buster) (4.19.67-2+deb10u1 (2019-09-20)
OpenSSL 1.1.1d  10 Sep 2019
Sqlcmd Version 17.4.0001.1 Linux

SQL server info:

Microsoft SQL Server 2012 (SP3-GDR) (KB4019092) - 11.0.6251.0 (X64) 
Jul  7 2017 07:14:24 
Copyright (c) Microsoft Corporation
Standard Edition (64-bit) on Windows NT 6.3 <X64> (Build 9600: )

Viewing all 4164 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>