Quantcast
Channel: SQL Server Express forum
Viewing all 3319 articles
Browse latest View live

TFS not recognizing previous version database after updating SQL server from 2014 to 2017

$
0
0

Updated SQL server from 2014 to 2017 by uninstalling SQL server 2014. Later realized that there was no project collection in the TFS and unable to create the new project.

Upgraded TFS 2016 to TFS 2018, still it is unable to recognize the previous project.

Any help will be appreciated.

Thanks


SSMS install problems

$
0
0

Tried to install SS express 2017, got some problems and ended up in uninstalling almost all of search for SQL in Programs And Features, except for MS SQL Server 2017 (64-bit) because it could not be uninstalled.

Then installed SS (express) 2017, but now I cannot install SSMS 18.3.1, it is just spinning with "Loading packages. Please wait..."
Waiting for hours and nothing happens.

What can I do?

Problem with Sql express 2017 - KB 2919355

$
0
0

Hello,

I have windows 10 and when i try to install sql express 2017, it says that i need KB2919355 wich is imposible because it's an update only available for windows 8.1 and windows server 2012.

I've searched online and found nothing, maybe somebody can help me?

Thank you,

SQL 2008 Installation Error : CS1567

$
0
0

Hi Friends,

Kindly help on the below error during SQL 2008 R2 installation .

Error : "error cs1567 sql server 2008 R2 "

Thanks in Advance 

Can't install SQL Server 2017

$
0
0

Windows 10

I can't install SQL Server 2017.

Overall summary:
  Final result:                  Failed: see details below
  Exit code (Decimal):           -2068052377
  Start time:                    2019-10-29 16:41:47
  End time:                      2019-10-29 16:44:44
  Requested action:              Install

Setup completed with required actions for features.
Troubleshooting information for those features:
  Next step for FullText:        Use the following information to resolve the error, and then try the setup process again.
  Next step for sql_inst_mpy:    Use the following information to resolve the error, and then try the setup process again.
  Next step for sql_inst_mr:     Use the following information to resolve the error, and then try the setup process again.
  Next step for AdvancedAnalytics: Use the following information to resolve the error, and then try the setup process again.
  Next step for SQLEngine:       Use the following information to resolve the error, and then try the setup process again.
  Next step for Replication:     Use the following information to resolve the error, and then try the setup process again.


Machine Properties:
  Machine name:                  ZZZ
  Machine processor count:       8
  OS version:                    Microsoft Windows 10 Pro (10.0.17134)
  OS service pack:               
  OS region:                     United States
  OS language:                   English (United Kingdom)
  OS architecture:               x64
  Process architecture:          64 Bit
  OS clustered:                  No

Product features discovered:
  Product              Instance             Instance ID                    Feature                                  Language             Edition              Version         Clustered  Configured

Package properties:
  Description:                   Microsoft SQL Server 2017 
  ProductName:                   SQL Server 2017
  Type:                          RTM
  Version:                       14
  SPLevel:                       0
  Installation location:         C:\SQLServer2017Media\ExpressAdv_ENU\x64\setup\
  Installation edition:          Express

Product Update Status:
  None discovered.

User Input Settings:
  ACTION:                        Install
  ADDCURRENTUSERASSQLADMIN:      true
  AGTSVCACCOUNT:                 NT AUTHORITY\NETWORK SERVICE
  AGTSVCPASSWORD:                *****
  AGTSVCSTARTUPTYPE:             Disabled
  ASBACKUPDIR:                   Backup
  ASCOLLATION:                   Latin1_General_CI_AS
  ASCONFIGDIR:                   Config
  ASDATADIR:                     Data
  ASLOGDIR:                      Log
  ASPROVIDERMSOLAP:              1
  ASSERVERMODE:                  TABULAR
  ASSVCACCOUNT:                  <empty>
  ASSVCPASSWORD:                 <empty>
  ASSVCSTARTUPTYPE:              Automatic
  ASSYSADMINACCOUNTS:            <empty>
  ASTELSVCACCT:                  <empty>
  ASTELSVCPASSWORD:              <empty>
  ASTELSVCSTARTUPTYPE:           0
  ASTEMPDIR:                     Temp
  BROWSERSVCSTARTUPTYPE:         Disabled
  CLTCTLRNAME:                   <empty>
  CLTRESULTDIR:                  <empty>
  CLTSTARTUPTYPE:                0
  CLTSVCACCOUNT:                 <empty>
  CLTSVCPASSWORD:                <empty>
  CLTWORKINGDIR:                 <empty>
  COMMFABRICENCRYPTION:          0
  COMMFABRICNETWORKLEVEL:        0
  COMMFABRICPORT:                0
  CONFIGURATIONFILE:             
  CTLRSTARTUPTYPE:               0
  CTLRSVCACCOUNT:                <empty>
  CTLRSVCPASSWORD:               <empty>
  CTLRUSERS:                     <empty>
  ENABLERANU:                    true
  ENU:                           true
  EXTSVCACCOUNT:                 NT Service\MSSQLLaunchpad$SQLEXPRESS
  EXTSVCPASSWORD:                <empty>
  FEATURES:                      SQLENGINE, REPLICATION, ADVANCEDANALYTICS, SQL_INST_MR, SQL_INST_MPY, FULLTEXT, CONN, BC, SDK, SNAC_SDK
  FILESTREAMLEVEL:               0
  FILESTREAMSHARENAME:           <empty>
  FTSVCACCOUNT:                  NT Service\MSSQLFDLauncher$SQLEXPRESS
  FTSVCPASSWORD:                 <empty>
  HELP:                          false
  IACCEPTPYTHONLICENSETERMS:     true
  IACCEPTROPENLICENSETERMS:      true
  IACCEPTSQLSERVERLICENSETERMS:  true
  INDICATEPROGRESS:              false
  INSTALLSHAREDDIR:              C:\Program Files\Microsoft SQL Server\
  INSTALLSHAREDWOWDIR:           C:\Program Files (x86)\Microsoft SQL Server\
  INSTALLSQLDATADIR:             <empty>
  INSTANCEDIR:                   C:\Program Files\Microsoft SQL Server\
  INSTANCEID:                    SQLEXPRESS
  INSTANCENAME:                  SQLEXPRESS
  ISMASTERSVCACCOUNT:            NT AUTHORITY\Network Service
  ISMASTERSVCPASSWORD:           <empty>
  ISMASTERSVCPORT:               8391
  ISMASTERSVCSSLCERTCN:          <empty>
  ISMASTERSVCSTARTUPTYPE:        Automatic
  ISMASTERSVCTHUMBPRINT:         <empty>
  ISSVCACCOUNT:                  NT AUTHORITY\Network Service
  ISSVCPASSWORD:                 <empty>
  ISSVCSTARTUPTYPE:              Automatic
  ISTELSVCACCT:                  <empty>
  ISTELSVCPASSWORD:              <empty>
  ISTELSVCSTARTUPTYPE:           0
  ISWORKERSVCACCOUNT:            NT AUTHORITY\Network Service
  ISWORKERSVCCERT:               <empty>
  ISWORKERSVCMASTER:             <empty>
  ISWORKERSVCPASSWORD:           <empty>
  ISWORKERSVCSTARTUPTYPE:        Automatic
  MATRIXCMBRICKCOMMPORT:         0
  MATRIXCMSERVERNAME:            <empty>
  MATRIXNAME:                    <empty>
  MRCACHEDIRECTORY:              
  NPENABLED:                     0
  PBDMSSVCACCOUNT:               <empty>
  PBDMSSVCPASSWORD:              <empty>
  PBDMSSVCSTARTUPTYPE:           0
  PBENGSVCACCOUNT:               <empty>
  PBENGSVCPASSWORD:              <empty>
  PBENGSVCSTARTUPTYPE:           0
  PBPORTRANGE:                   <empty>
  PBSCALEOUT:                    false
  PID:                           *****
  QUIET:                         false
  QUIETSIMPLE:                   false
  ROLE:                          AllFeatures_WithDefaults
  RSINSTALLMODE:                 DefaultNativeMode
  RSSVCACCOUNT:                  <empty>
  RSSVCPASSWORD:                 <empty>
  RSSVCSTARTUPTYPE:              Automatic
  SAPWD:                         <empty>
  SECURITYMODE:                  <empty>
  SQLBACKUPDIR:                  <empty>
  SQLCOLLATION:                  Polish_CI_AS
  SQLSVCACCOUNT:                 NT Service\MSSQL$SQLEXPRESS
  SQLSVCINSTANTFILEINIT:         false
  SQLSVCPASSWORD:                <empty>
  SQLSVCSTARTUPTYPE:             Automatic
  SQLSYSADMINACCOUNTS:           zzz\ccc
  SQLTELSVCACCT:                 NT Service\SQLTELEMETRY$SQLEXPRESS
  SQLTELSVCPASSWORD:             <empty>
  SQLTELSVCSTARTUPTYPE:          Automatic
  SQLTEMPDBDIR:                  <empty>
  SQLTEMPDBFILECOUNT:            1
  SQLTEMPDBFILEGROWTH:           64
  SQLTEMPDBFILESIZE:             8
  SQLTEMPDBLOGDIR:               <empty>
  SQLTEMPDBLOGFILEGROWTH:        64
  SQLTEMPDBLOGFILESIZE:          8
  SQLUSERDBDIR:                  <empty>
  SQLUSERDBLOGDIR:               <empty>
  SUPPRESSPRIVACYSTATEMENTNOTICE: false
  TCPENABLED:                    0
  UIMODE:                        AutoAdvance
  UpdateEnabled:                 true
  UpdateSource:                  MU
  USEMICROSOFTUPDATE:            false
  X86:                           false

  Configuration file:            C:\Program Files\Microsoft SQL Server\140\Setup Bootstrap\Log\20191029_164145\ConfigurationFile.ini

Detailed results:
  Feature:                       Full-Text and Semantic Extractions for Search
  Status:                        Failed
  Reason for failure:            An error occurred for a dependency of the feature causing the setup process for the feature to fail.
  Next Step:                     Use the following information to resolve the error, and then try the setup process again.
  Component name:                SQL Server Database Engine Services Instance Features
  Component error code:          1639
  Component log file:            C:\Program Files\Microsoft SQL Server\140\Setup Bootstrap\Log\20191029_164145\sql_engine_core_inst_Cpu64_1.log
  Error description:             Invalid command line argument. Consult the Windows Installer SDK for detailed command line help.
  Error help link:               https://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=14.0.1000.169&EvtType=sql_engine_core_inst.msi%400x162A16FE%400x1639

  Feature:                       Python
  Status:                        Failed
  Reason for failure:            An error occurred for a dependency of the feature causing the setup process for the feature to fail.
  Next Step:                     Use the following information to resolve the error, and then try the setup process again.
  Component name:                SQL Server Database Engine Services Instance Features
  Component error code:          1639
  Component log file:            C:\Program Files\Microsoft SQL Server\140\Setup Bootstrap\Log\20191029_164145\sql_engine_core_inst_Cpu64_1.log
  Error description:             Invalid command line argument. Consult the Windows Installer SDK for detailed command line help.
  Error help link:               https://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=14.0.1000.169&EvtType=sql_engine_core_inst.msi%400x162A16FE%400x1639

  Feature:                       R
  Status:                        Failed
  Reason for failure:            An error occurred for a dependency of the feature causing the setup process for the feature to fail.
  Next Step:                     Use the following information to resolve the error, and then try the setup process again.
  Component name:                SQL Server Database Engine Services Instance Features
  Component error code:          1639
  Component log file:            C:\Program Files\Microsoft SQL Server\140\Setup Bootstrap\Log\20191029_164145\sql_engine_core_inst_Cpu64_1.log
  Error description:             Invalid command line argument. Consult the Windows Installer SDK for detailed command line help.
  Error help link:               https://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=14.0.1000.169&EvtType=sql_engine_core_inst.msi%400x162A16FE%400x1639

  Feature:                       Machine Learning Services (In-Database)
  Status:                        Failed
  Reason for failure:            An error occurred for a dependency of the feature causing the setup process for the feature to fail.
  Next Step:                     Use the following information to resolve the error, and then try the setup process again.
  Component name:                SQL Server Database Engine Services Instance Features
  Component error code:          1639
  Component log file:            C:\Program Files\Microsoft SQL Server\140\Setup Bootstrap\Log\20191029_164145\sql_engine_core_inst_Cpu64_1.log
  Error description:             Invalid command line argument. Consult the Windows Installer SDK for detailed command line help.
  Error help link:               https://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=14.0.1000.169&EvtType=sql_engine_core_inst.msi%400x162A16FE%400x1639

  Feature:                       Database Engine Services
  Status:                        Failed
  Reason for failure:            An error occurred during the setup process of the feature.
  Next Step:                     Use the following information to resolve the error, and then try the setup process again.
  Component name:                SQL Server Database Engine Services Instance Features
  Component error code:          1639
  Component log file:            C:\Program Files\Microsoft SQL Server\140\Setup Bootstrap\Log\20191029_164145\sql_engine_core_inst_Cpu64_1.log
  Error description:             Invalid command line argument. Consult the Windows Installer SDK for detailed command line help.
  Error help link:               https://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=14.0.1000.169&EvtType=sql_engine_core_inst.msi%400x162A16FE%400x1639

  Feature:                       SQL Server Replication
  Status:                        Failed
  Reason for failure:            An error occurred during the setup process of the feature.
  Next Step:                     Use the following information to resolve the error, and then try the setup process again.
  Component name:                SQL Server Database Engine Services Instance Features
  Component error code:          1639
  Component log file:            C:\Program Files\Microsoft SQL Server\140\Setup Bootstrap\Log\20191029_164145\sql_engine_core_inst_Cpu64_1.log
  Error description:             Invalid command line argument. Consult the Windows Installer SDK for detailed command line help.
  Error help link:               https://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=14.0.1000.169&EvtType=sql_engine_core_inst.msi%400x162A16FE%400x1639

  Feature:                       SQL Browser
  Status:                        Passed

  Feature:                       SQL Writer
  Status:                        Passed

  Feature:                       Client Tools SDK
  Status:                        Passed

  Feature:                       Client Tools Connectivity
  Status:                        Passed

  Feature:                       Client Tools Backwards Compatibility
  Status:                        Passed

  Feature:                       SQL Client Connectivity
  Status:                        Passed

  Feature:                       SQL Client Connectivity SDK
  Status:                        Passed

  Feature:                       Setup Support Files
  Status:                        Passed

Rules with failures:

Global rules:

Scenario specific rules:

Rules report file:               C:\Program Files\Microsoft SQL Server\140\Setup Bootstrap\Log\20191029_164145\SystemConfigurationCheck_Report.htm


SQL writer and backup

$
0
0

So, someone installed two versions of sql express in the same box. One is 2008 r2 and the other 2014. Both installs are tied to separate applications. 

The problem is we are not able to backup the database via an enterprise application that we use to backup all other sql servers. Researching, we found out that there is no sql writer service on that server. The databases on both the installs do not have extra space in their names. So, that is out of the equation. Also, searching for sqlvdi.dll yielded no result on C drive where those express editions are installed. 

Can anyone shed some light please? 

Always Encrypted and SSMS

$
0
0

Hi,

I have done column encryption in SSMS , but I can't solve it using the "Column Encryption Setting=Enable" parameter.

Could you help?

Best regards

Always Encrypted

$
0
0

Hi,

Why can't I add data to the encrypted column?

what should I do?

received error ;

invalid value for cell(row5, column 1)

The changed value in this cell was not recognized as valid.

.Net Framework Data type: byte

Error message:you cannot use the result pane to set this field data to values other than null.

type a value appropriate for the data type or press esc to cancel the change.


Can I re-install Windows and SQL Server Express on C: and still use my database on D: ?

$
0
0

Hi,

I would like to re-install Windows 10 and SQL Server Express 2014 on my disk C.

My database is on disk D in a .mdf file together with a .log.ldf file.

Can I just re-install Windows 10 and SQL Server Express 2014 and will it connect again with the database on disk D or do I need to make specific back-ups or any other specific actions?

Thank you!


MB

Installation problem SQL Express 2008 on Windows 10 Home

$
0
0

Trying to install a package which is installing SQL Express quietly and failing.

I am unable to tell whether it is SQL Express that is failing or some other component, but the install log says:

Installing using command 'C:\Users\xx\AppData\Local\Temp\VSD42D4.tmp\SQLExpress 2008\SQLEXPR_x86_ENU.exe' and parameters '/Q /QUIET /hideconsole  /INSTANCEID="PatientBase" /INSTANCENAME="PATIENTBASE" /SQLSYSADMINACCOUNTS="BUILTIN\ADMINISTRATORS" /ADDCURRENTUSERASSQLADMIN=false /SQLSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE" /FEATURES=SQLENGINE /SECURITYMODE="SQL" /SAPWD="wdgNGvrt-x4JeKWp" /ACTION="Install" /INSTANCEDIR="%AllUsersProfile%\Starkey Laboratories\PatientBase" /IACCEPTSQLSERVERLICENSETERMS /SKIPRULES=PerfMonCounterNotCorruptedCheck'
Process exited with code -2147024893
Status of package 'PatientBase Database' after install is 'InstallFailed'

No SQL installed and there are some logs at C:\Program Files (x86)\Microsoft SQL Server\100\Setup Bootstrap\Log if they would be helpful...

I am by no means an expert, but should I be able to run the SQL Express manually from SQLEXPR_x86_ENU.exe and enter those parameters manually?

Need assistance with SQL statement that evaluates multiple tables

$
0
0

Hello,

This question is two fold. Before I get into what I am trying to do, let me explain my tables a bit. I have 10 tables (each populated by a different export and for the sake of explanation called tbl_1, tbl_2, tbl_3, etc) with the following two column headers:Package #, Description.

Ask 1:

I want to be able to do query all 10 tables and evaluate whether a package # is shared across the tables or missing from some of the tables and it would go through every possible package number found in the 10 tables. Ideally, I would like to create a temp table that would look such as this:

package #     tbl_1     tbl_2          tbl_3

12345           Found    Notfound    Found

Ask 2:

I want to be able to search a single package number or multiple package numbers and evaluate which tables this number(s) exist on.

Please help. 

LocalDB cannot attach database

$
0
0

Using Native Client 11.0 ODBC Driver, trying to programatically attach a database "DB A" to a LocalDB instance leads to an attempt to attach a different "DB B", resulting in the following error (shown on the ODBC trace log):

DIAG [28000] [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'xxx\xxxxxxx'. (18456) 

DIAG [42000] [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot open database "Database B" requested by the login. The login failed. (4060) 

DIAG [01S00] [Microsoft][SQL Server Native Client 11.0]Invalid connection string attribute (0) 

Seems to be that previous connection through ODBC is being cached somewhere.

Have tried:

1. Restarted computer

2. Deleting LocalDB instance folder AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances 

3. Complete Re-install of localdb

Neither works, would there be any other places where ODBC is caching connection instances?

More from the ODBC trace:

50ec-5264ENTER SQLAllocHandle 
SQLSMALLINT     1 <SQL_HANDLE_ENV>
SQLHANDLE       0x0000000000000000
SQLHANDLE *     0x000000001126F388

50ec-5264EXIT  SQLAllocHandle  with return code 0 (SQL_SUCCESS)
SQLSMALLINT     1 <SQL_HANDLE_ENV>
SQLHANDLE       0x0000000000000000
SQLHANDLE *     0x000000001126F388 ( 0x000000002DF90D40)

50ec-5264ENTER SQLSetEnvAttr 
SQLHENV         0x000000002DF90D40
SQLINTEGER      200 <SQL_ATTR_ODBC_VERSION>
SQLPOINTER      3 <SQL_OV_ODBC3>
SQLINTEGER      -6 

50ec-5264EXIT  SQLSetEnvAttr  with return code 0 (SQL_SUCCESS)
SQLHENV         0x000000002DF90D40
SQLINTEGER      200 <SQL_ATTR_ODBC_VERSION>
SQLPOINTER      3 <SQL_OV_ODBC3>
SQLINTEGER      -6 

50ec-5264ENTER SQLSetEnvAttr 
SQLHENV         0x000000002DF90D40
SQLINTEGER      201 <SQL_ATTR_CONNECTION_POOLING>
SQLPOINTER      2 <SQL_CP_ONE_PER_HENV>
SQLINTEGER      -6 

50ec-5264EXIT  SQLSetEnvAttr  with return code 0 (SQL_SUCCESS)
SQLHENV         0x000000002DF90D40
SQLINTEGER      201 <SQL_ATTR_CONNECTION_POOLING>
SQLPOINTER      2 <SQL_CP_ONE_PER_HENV>
SQLINTEGER      -6 

50ec-5264ENTER SQLAllocHandle 
SQLSMALLINT     2 <SQL_HANDLE_DBC>
SQLHANDLE       0x000000002DF90D40
SQLHANDLE *     0x000000001126F430

50ec-5264EXIT  SQLAllocHandle  with return code 0 (SQL_SUCCESS)
SQLSMALLINT     2 <SQL_HANDLE_DBC>
SQLHANDLE       0x000000002DF90D40
SQLHANDLE *     0x000000001126F430 ( 0x000000002DF90E20)

50ec-5264ENTER SQLSetConnectAttrW 
SQLHDBC         0x000000002DF90E20
SQLINTEGER      103 <SQL_ATTR_LOGIN_TIMEOUT>
SQLPOINTER      0
SQLINTEGER      -5 

50ec-5264EXIT  SQLSetConnectAttrW  with return code 0 (SQL_SUCCESS)
SQLHDBC         0x000000002DF90E20
SQLINTEGER      103 <SQL_ATTR_LOGIN_TIMEOUT>
SQLPOINTER      0
SQLINTEGER      -5 

50ec-5264ENTER SQLDriverConnectW 
HDBC            0x000000002DF90E20
HWND            0x0000000000000000
WCHAR *         0x00007FFB794121C0 [      -3] "******\ 0"
SWORD           -3 
WCHAR *         0x00007FFB794121C0 
SWORD           -3 
SWORD *         0x0000000000000000
UWORD           0 <SQL_DRIVER_NOPROMPT>

50ec-5264EXIT  SQLDriverConnectW  with return code -1 (SQL_ERROR)
HDBC                0x000000002DF90E20
HWND                0x0000000000000000
WCHAR *             0x00007FFB794121C0 [      -3] "******\ 0"
SWORD               -3 
WCHAR *             0x00007FFB794121C0 
SWORD               -3 
SWORD *             0x0000000000000000
UWORD               0 <SQL_DRIVER_NOPROMPT>

DIAG [28000] [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'xxx\xxxxxxx'. (18456) 

DIAG [42000] [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot open database "Other Database" requested by the login. The login failed. (4060) 

DIAG [01S00] [Microsoft][SQL Server Native Client 11.0]Invalid connection string attribute (0) 

DIAG [28000] [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'xxx\xxxxxxx'. (18456) 

DIAG [42000] [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot open database "Other Database" requested by the login. The login failed. (4060) 

DIAG [01S00] [Microsoft][SQL Server Native Client 11.0]Invalid connection string attribute (0) 


Migrate localdb to express (server)

$
0
0
Is there a simple way to migrate (or backup/restore etc.) a LocalDB to a SQL Server (or Express ditto)?

Facing Problem When Calling Web API from SQL Function

$
0
0

Hello Team,

I am calling API of web service inside of SQL Function. Currently I have created stored proc which contains logic mentioned below. I have to execute this logic from SQL view, but from view we can not call stored proc. So decided to convert this running stored proc to SQL function.

In given below created SQL function, we are getting response Text which is inserted to variable (highlighted in bold). This logic is perfectly working fine in stored proc, but not able to execute INSERT inside SQL function. Can you please guide me in this case. 

Note -  I have tried OpenQuery() concept also, but didn't help much.

SQL Function -

CREATE FUNCTION [Default].[GetImageData]

(
       @document_ID UNIQUEIDENTIFIER
)
RETURNS nvarchar(MAX)
AS
BEGIN

        Declare @Object as Int;
        DEClare @docStorageUrl nvarchar(100);
        DEClare @idparam nvarchar(100);
       DEClare @url nvarchar(max);
       declare @requestText nvarchar(max);
      DECLARE @status NVARCHAR(32);
  declare @res int;
  DECLARE @ret INT;
  DECLARE @statusText NVARCHAR(32);
  DECLARE @source varchar(255), @desc varchar(255)
  DECLARE @responseText as table(responseText nvarchar(max))
  DECLARE @responseXMLText as nvarchar(MAX)
  DECLARE @responseXMLText2 as nvarchar(MAX)
  DECLARE @Response VARCHAR(MAX)
  DECLARE @responseXMLText1 VARCHAR(MAX)
  DECLARE @sql VARCHAR(8000)
  DECLARE @cmd VARCHAR(8000)

 set @idparam = CONVERT(nvarchar(100), @document_ID)

 

SET @requestText = '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><GetDocumentDataByDocumentID xmlns="http://tempuri.org/"><documentId>abcdf3e67-af00-xa11-a8102-005056a2e7eb</documentId></GetDocumentDataByDocumentID></s:Body></s:Envelope>' -- include the id in the correct bit(see fiddler)

    set @url= 'http://10.101.19.188:8082/ABC.svc'

    Exec sp_OACreate 'MSXML2.ServerXMLHTTP', @Object OUT;
    Exec sp_OASetProperty @Object, 'NtlmAuth', 1;
    Exec @ret = sp_OAMethod @Object, 'open', NULL, 'POST', @url, 'false', 'ValidUser', 'Test1';
    Exec @ret = sp_OAMethod @Object, 'setRequestHeader', NULL, 'Content-Type', 'text/xml; charset=utf-8';
    Exec @ret = sp_OAMethod @Object, 'setRequestHeader', NULL, 'Content-Length', 242;
    Exec @ret = sp_OAMethod @Object, 'setRequestHeader', NULL, 'SOAPAction',  'http://tempuri.org/IDocStorage/GetDocumentDataByDocumentID'; 
    Exec @res = sp_OAMethod @Object, 'send', NULL, @requestText;

  -- Handle response
 EXEC @ret = sp_OAGetProperty @Object, 'status', @status OUT;
 EXEC sp_OAGetErrorInfo @Object, @source OUT, @desc OUT
 EXEC @ret = sp_OAGetProperty @Object, 'statusText', @statusText OUT;

 INSERT INTO @ResponseText (ResponseText) EXEC sp_OAGetProperty @Object, 'responseText'

 Select @responseXMLText = ResponseText from @ResponseText

SET @responseXMLText1 = CONVERT(nvarchar(max), CAST( @responseXMLText AS XML).query('declare namespace s="http://schemas.xmlsoap.org/soap/envelope/"; declare namespace t="http://tempuri.org/"; /s:Envelope/s:Body/t:GetDocumentDataByDocumentIDResponse/t:GetDocumentDataByDocumentIDResult/text()'))

  RETURN @responseXMLText1;
 
END
GO

Thanks,

Sudarshan Gujar


Exclamation Mark vs. Green Arrow

$
0
0

Hi All

I do not know why on some workstation I have Exclamation Mark next to Execute in SSMS and on another workstations Green Arrow - both SSMS works OK but why is the difference?

Thanks in advance :)


how to use Case condition in Two table joining

$
0
0

hi there,

i want to use conditional joining in two table join because i have huge date and suddenly i found sum of my supplier are sale same item name with different price in same invoice now when i received in store side its showing all together quantity. but i want to separate this by auto-number ID every thing is working fine but now old date doesn't have Auto-Number ID. Old Date has PONumber and ProductCode i want to write string where POAtn(this is Auto-Number ID) is null then its look only ON A.PCode = B.ProductCode AND A.PONumber = B.LPONo when POAtn(this is Auto-Number ID) is not null then it look ON A.AutoNumber = B.POAtn

below is my complete string

SELECT A.PCode, A.RequiredQty, A.PONumber, A.StoreLocation, A.LedgerName, B.TotalKG, A.RequiredQty - ISNULL(B.TotalKG,0) BALANCE, 
Rate 
FROM 
(SELECT 
PRDate, 
PCode, 
SUM(RQty) AS RequiredQty, 
dbo.tblPReq.PONumber, 
ISNULL(Switchee,0) AS Switchee, 
StoreLocation, 
A1.LedgerName, 
Unit, 
Rate, 
AutoNumber 
FROM dbo.tblPReq 
LEFT JOIN tblCustomers A1 ON tblPReq.SupplierCode = A1.CustomerCode
WHERE PRDate<= @sDate AND A1.LedgerName IS NOT NULL
AND dbo.tblPReq.PONumber IS NOT NULL AND dbo.tblPReq.ClosePO IS NULL
GROUP BY PRDate, PCode, dbo.tblPReq.PONumber, Switchee, StoreLocation, A1.LedgerName, Unit, Rate, AutoNumber 
) A
LEFT JOIN 

----PO ORDER
(SELECT ProductCode, 
SUM(TotalKG) TotalKG, 
LPONo, POAtn
FROM dbo.tblStocksReceived 
WHERE DateReceived <= @sDate
GROUP BY ProductCode, LPONo, POAtn) B 
ON CASE WHEN B.POAtn IS NULL THEN A.PCode = B.ProductCode AND A.PONumber = B.LPONo ELSE A.AutoNumber = B.POAtn END


Change the default location of databases fails with access denied

$
0
0

I use Sql Server management studio 18.3.1 to change the default directory path for databases for Sql Server 2016 LocalDb instance. But i receive the error:

RegCreateKeyEx() returned error 5, 'Access is denied.' (Microsoft SQL Server, Error: 22002)

I tried to add the user NT SERVICE\MSSQLSERVER to the folder where i moved the databases, but it didn't work.

I also ran Sql Server management studio as an administrator, but still the access denied.

Any suggestions?

SFTP in TSQL

$
0
0

Hi

I have to write a tsql stored procedure, to export a table with data, to a csv file and send that file to a sftp location.

Is this task possible to do in tsql?

Thanks

Sai


Royal Thomas

Install of SQLServer2017-SSEI-Expr.exe fails with "A required file could not be downloaded...."

$
0
0

I have downloaded the free version of SQL Server 2017 Express Edition.  Upon trying to install, it fails with

"Oops....A required file could not be downloaded.  This could mean the version of the installer is no longer supported.  Pleas download again from the download site.  https://go.microsoft.com/fwlink/?LinkID=853017 "

When I click the link it downloads another instance of the same executable.  This second instance renders the same error message.

OS is Windows Server 2016

Running install as an Administrator.

Tried SQL Server 2016 Express Edition and that executable also gave me the same error message.

This is a clean installation in the sense that no prior versions of SQL Express have ever been installed.

I cannot find an installer that has the complete build (ie. will install without trying to go outside to download anything else).

Thanks for any help / advice.

Cannot start SQL Server Express 2017

$
0
0

I setup SQL 2017 Express.

I chose custom install and the installation directory was different from the default one.

I create a new database and then two tables in this database.

I entered a wrong query in SQL management studio and then SQL management studio was disconnected from the SQL server.

Then, I cannot connect again.

I typed sqlcmd -S myPC\SQLEXPRESS -E and obtained:

Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Shared Memory Provider: Could not open a connection to SQL Server [2]. .
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..

Then, I typed "D:\Microsoft SQL Server\MSSQL14.SQLEXPRESS\MSSQL\Binn\sqlservr.exe" -sSQLEXPRESS, I obtained a long message. Here is the last few lines:

2018-11-30 11:02:39.29 spid6s      Uploading data collector package from disk: D:\Microsoft SQL Server\MSSQL14.SQLEXPRESS\MSSQL\Install\SqlTraceCollect.dtsx
2018-11-30 11:02:39.29 spid6s      Uploading data collector package from disk: D:\Microsoft SQL Server\MSSQL14.SQLEXPRESS\MSSQL\Install\SqlTraceCollect.dtsx
2018-11-30 11:02:39.29 spid6s      Error: 2775, Severity: 17, State: 12.
2018-11-30 11:02:39.29 spid6s      The code page 65001 is not supported by the server.
2018-11-30 11:02:39.30 spid6s      Error: 912, Severity: 21, State: 2.
2018-11-30 11:02:39.30 spid6s      Script level upgrade for database 'master' failed because upgrade step 'msdb110_upgrade.sql' encountered error 200, state 7, severity 25. This is a serious error condition which might interfere with regular operation and the database will be taken offline. If the error happened during upgrade of the 'master' database, it will prevent the entire SQL Server instance from starting. Examine the previous errorlog entries for errors, take the appropriate corrective actions and re-start the database so that the script upgrade steps run to completion.
2018-11-30 11:02:39.30 spid6s      Error: 3417, Severity: 21, State: 3.
2018-11-30 11:02:39.30 spid6s      Cannot recover the master database. SQL Server is unable to run. Restore master from a full backup, repair it, or rebuild it. For more information about how to rebuild the master database, see SQL Server Books Online.
2018-11-30 11:02:39.30 spid6s      SQL Server shutdown has been initiated
2018-11-30 11:02:39.32 spid6s      SQL Trace was stopped due to server shutdown. Trace ID = '1'. This is an informational message only; no user action is required.

What happened to my SQL server?

Why can't I start it?

How to make it work?

In fact, I have reinstalled it for 3 times and I really want to know how to solve this problem.

Can anyone help?

Thank you very much.




Viewing all 3319 articles
Browse latest View live


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