MSSQL Scope_Identity()

I realize the answer to this may be "upgrade" but I truly
hope not. I have got a cfquery that inserts a record into a
database, and then in the same statement selects the
scope_identity() sql function to get the identity of the record
that was just inserted. I have tested the code on my local CFMX7
server and it works properly. Unfortunately I can't run the script
from my local server, it has to be run from a server that's still
using CF5. When using CF5 I get an error resolving the value of the
parameter. I'm hoping someone knows some trick to CF5 to allow it
to perform multiple commands against a database table (which I
assume to be the problem). The code is attached. Please let me know
if you need any other information. Thanks,
--Daniel

Your query will work in CFMX7. But for CF 5, well I am not
sure. Please try this for CF 5.
<cfquery datasource="#datasource#" name="InsertPOA">
INSERT INTO PreferredOperatorApp....
</cfquery>
<cfquery datasource="#datasource#" name="InsertPOA">
SELECT Scope_Identity() As LastInsert
</cfquery>
<cfdump var="#InsertPOA#">
Please note, your datasource should be same in both the
queries.
Thanks
Sankalan
(www.mindfiresolutions.com)

Similar Messages

  • Has anyone ever succeeded to use the scope_identity() from the LabVIEW DB toolkit ?

    Hi,
    Using LabVIEW 2014 DS, and MSSQL 2008R2.
    I have configured a table with identity, so the indexed will be incremented automatically.
    I am trying to get the ID of the last Insert command that I am using.
    I am trying to SELECT SCOPE_IDENTITY() but with no success.
    I read about trying to so it with a procedure or transaction, but I just could not succeed myself.
    Has anyone ever succeeded to use the scope_identity() from the LabVIEW DB toolkit ?
    If yes, can you please elaborate more or even share the code ?
    Thanks, 
    Amitai.

    Yes I have...let me dig out some code...
    I do my INSERT query (with a semicolon at the end) and in the same query string do a "SELECT SCOPE_IDENTITY() as inserted_id;" - essentially what you're doing here is running two queries in one - one to insert your data and the second to retrieve the ID. From what I remember of when I did this (last year?), I think scope_identity() is valid for the same connection so as you're doing both queries in the same connection it should always be valid.
    I then do this to get the ID (pardon the crappy VI snippet):
    Essentially I execute the query and the result is a 2D array that contains one row/column which is your last inserted ID.
    Certified LabVIEW Architect, Certified TestStand Developer
    NI Days (and A&DF): 2010, 2011, 2013, 2014
    NI Week: 2012, 2014
    Knowledgeable in all things Giant Tetris and WebSockets

  • CF8, MS-SQL, scope_identity()

    In CFMX 6-7, I used to write the following:
    <cfquery dbname=name dbtype=odbc name=myInsertQuery>
    insert into myTable (field1,field2,field3) select top 1
    'VALUE1' as value1,value2,value3 from myOtherTable where something
    = something
    select scope_identity() as NEWVAL from myTable
    </cfquery>
    <cfoutput>#myInsertQuery.NEWVAL#</cfouput>
    This would work perfectly fine. Now, in CF8, this no longer
    works. A slightly less complicated insert query that doesn't
    involve selecting from another table does return a scope_identity
    value (as well as the new result struct in CF8
    queryname.identitycol), but the more complex one that I demostrate
    above does not.
    Has anyone else experienced this? Could this be a result of
    running MS-SQL2000 instead of MS-SQL2005?
    I have submitted this on the bug reports and on the cfquery
    livedoc, but haven't received any response todate.
    -Phil

    Some strange stuff....
    The following works in CF7 with the built-in MSSQL or JDBC
    1.0 driver.
    It also works in CF8 with the built-in MSSQL driver.
    insert into myTable (myField)
    values ('myValue');
    select scope_identity() as myAliasName
    If I'm using the JDBC 1.0 driver in CF8, I must wrap the
    query with the "SET NOCOUNT" statements for it to work:
    SET NOCOUNT OFF;
    insert into myTable (myField)
    values ('myValue');
    select scope_identity() as myAliasName;
    SET NOCOUNT ON:
    Now, when using the JDBC v1.2 driver in CF8, the SET NOCOUNT
    statements do not work. The insert works but the query is
    undefined. result.RECORDCOUNT=0.
    If you remove the SET NOCOUNT statements, myAliasName is
    undefined but the query will be defined and you will get a value
    for queryName.GENERATED_KEYS. result.RECORDCOUNT=1. It seems the
    alias is ignored.
    If you now
    remove the select scope_identity() statement so that you
    only have the INSERT statement, the query will be undefined but now
    the result variable will contain a GENERATED_KEYS value. Also,
    RECORDCOUNT=1 even though the query is undefined. (Note: you must
    remove the scope_identity() statement. If you just comment it out
    with SQL comments, the insert will work but GENTERATED_KEYS will be
    undefined and RECORDCOUNT=0).
    I'm not sure yet what to make of this info. I'm using CF8 in
    development and CF7 in production. If I use the built-in Microsoft
    SQL Server driver for both environments, I don't need to make any
    changes to my code. That's what I'm doing for the time being.

  • Keep the SQL Scope_Identity() value

    I’ve got a process that inserts data into a sql server using the Execute SQL Statement.
    I use the Scope_Identity() to get the index value for subsequent inserts to other tables.
    Is there a way to get that value back into the process?
    I need to know the value several steps later.

    Some strange stuff....
    The following works in CF7 with the built-in MSSQL or JDBC
    1.0 driver.
    It also works in CF8 with the built-in MSSQL driver.
    insert into myTable (myField)
    values ('myValue');
    select scope_identity() as myAliasName
    If I'm using the JDBC 1.0 driver in CF8, I must wrap the
    query with the "SET NOCOUNT" statements for it to work:
    SET NOCOUNT OFF;
    insert into myTable (myField)
    values ('myValue');
    select scope_identity() as myAliasName;
    SET NOCOUNT ON:
    Now, when using the JDBC v1.2 driver in CF8, the SET NOCOUNT
    statements do not work. The insert works but the query is
    undefined. result.RECORDCOUNT=0.
    If you remove the SET NOCOUNT statements, myAliasName is
    undefined but the query will be defined and you will get a value
    for queryName.GENERATED_KEYS. result.RECORDCOUNT=1. It seems the
    alias is ignored.
    If you now
    remove the select scope_identity() statement so that you
    only have the INSERT statement, the query will be undefined but now
    the result variable will contain a GENERATED_KEYS value. Also,
    RECORDCOUNT=1 even though the query is undefined. (Note: you must
    remove the scope_identity() statement. If you just comment it out
    with SQL comments, the insert will work but GENTERATED_KEYS will be
    undefined and RECORDCOUNT=0).
    I'm not sure yet what to make of this info. I'm using CF8 in
    development and CF7 in production. If I use the built-in Microsoft
    SQL Server driver for both environments, I don't need to make any
    changes to my code. That's what I'm doing for the time being.

  • Error while creating a new DAC connection using connection type MSSQL

    Hi,
    I am trying to create a new DAC connection i.e. a new DAC repository in the SQL Server 2008 database.
    DAC version : 10.1.3.4.1
    Database : SQL Server 2008
    I have downloaded the sqljdbc4.jar file from the below link and placed it in the D:\orahome\10gR3_1\bifoundation\dac\lib folder.
    [http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11774 ]
    I have entered all the details correctly for database name, database host, database port. I created a new Authentication file.
    I get the below error when I try to test the connection.
    MESSAGE:::MSSQL driver not available!
    EXCEPTION CLASS::: java.lang.IllegalArgumentException
    com.siebel.etl.gui.login.LoginDataHandler$LoginStructure.testConnection(LoginDataHandler.java:512)
    com.siebel.etl.gui.login.LoginDataHandler.testConnection(LoginDataHandler.java:386)
    com.siebel.etl.gui.login.ConnectionTestDialog$Executor.run(ConnectionTestDialog.java:290)
    ::: CAUSE :::
    MESSAGE:::com.microsoft.sqlserver.jdbc.SQLServerDriver
    EXCEPTION CLASS::: java.lang.ClassNotFoundException
    java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    java.security.AccessController.doPrivileged(Native Method)
    java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    java.lang.Class.forName0(Native Method)
    java.lang.Class.forName(Class.java:169)
    com.siebel.etl.gui.login.LoginDataHandler$LoginStructure.testConnection(LoginDataHandler.java:510)
    com.siebel.etl.gui.login.LoginDataHandler.testConnection(LoginDataHandler.java:386)
    com.siebel.etl.gui.login.ConnectionTestDialog$Executor.run(ConnectionTestDialog.java:290)
    The error seems to be a connectivity issue with SQL Server. Am I using the correct jar file?
    Please help me out in resolving this issue. Appreciate the help provided on this forum earlier.
    Thank You

    Add
    .\lib\sqljdbc4.jar
    at end of the line starting with SQLSERVERLIB in config.bat file
    Pls mark correct

  • Error while defining USB dribe as backup device in MSSQL

    Hi all, i am facing this error when i am creating a new backup device in MSSQL and while watching media contents.
    System.Data.SqlClient.SqlError: Cannot open backup device 'SAPMSQLDB(E:\SAPBackup\SAPMSQLDB.bak)'. Operating system error 2(The system cannot find the file specified.). (Microsoft.SqlServer.Smo)
    and i am getting this error in DB13
    "Cannot open backup device 'SAPMSQLDB(E:\SAPBackup\SAPMSQLDB.bak)'. Oper"
    when you are creating a new device what should be the file name ???? i specified a file name but its not in the folder i think this might be the cause but i dont know what is the name of file or do i need to prepare the folder i mean to create some temporary files?
    appreiate any reply.
    thanks
    Mani

    Well i executed Full database backup
    i have few question
    1. The output is only one file or more files as i have only one file called filename.bak aftre backup from SAP?
    2. below is the detail of  DB12 output, DB13 and error log
    in DB12 it shows its successfully executed with code ok.
    in DB13 PREVIEW tab here is the log it shows
    I am not sure it executed succesfully,  it created backup in one file called DBNOV.bak
    exec msdb..sp_add_job  @originating_server = '(local)',@job_name = "SAP CCMS Full DB Backup of
    SID [20081112160619-3-173000]",@enabled = 1,@description = "SAP CCMS JOB",@start_step_id = 1,
    @category_name = NULL,@category_id = NULL
    exec msdb..sp_add_jobstep @job_id = null,@job_name = 'SAP CCMS Full DB Backup of SID
    [20081112160619-3-173000]',@step_id = 1,@step_name = 'CCMS-step 1',@subsystem =
    'TSQL',@command = 'declare @exeStmt nvarchar(2000) exec sid.sap_backup_databases
    @dbList="SID",@r3Db="SID",@bDev="USBDB",@expDays= 27,@bkupChecksum="N",@jobName= "SAP CCMS
    Full DB Backup of SID [20081112160619-3-173000]",@bkupType="F",@nativeBkup="N",@exeDate =
    "20081112173000",@bkupSim = "Y",@format = 0,@init = 0,@bkupDb = "SID",@unload = 0,@exeStmt =
    @exeStmt OUTPUT',@database_name = 'SID',@on_success_action = 3
    BACKUP DATABASE SID TO USBDB WITH
    DESCRIPTION = 'SAP CCMS Full DB Backup of SID [20081112160619-3-173000]',RETAINDAYS=27,
    NOINIT,
    NAME = 'Sap backup on 20081112 21:27:40',NOUNLOAD
    exec msdb..sp_add_jobstep @job_id = null,@job_name = 'SAP CCMS Full DB Backup of SID
    [20081112160619-3-173000]',@step_id = 2,@step_name = 'CCMS-step 2',@subsystem =
    'TSQL',@command = 'declare @exeStmt nvarchar(2000) exec sid.sap_verify_backups @nativeBkup =
    "N",@bkupSim = "Y",@bDev = "USBDB",@bkupChecksum = "N",@exeDate = "20081112173000",@unload =
    0,@dbCnt  =1,@exeStmt = @exeStmt OUTPUT',@database_name = 'SID'
    RESTORE VERIFYONLY FROM USBDB WITH FILE = X ,NOUNLOAD
    exec msdb..sp_add_jobschedule @job_id = null,@job_name = 'SAP CCMS Full DB Backup of SID
    [20081112160619-3-173000]',@name = 'CCMS-sche1',@enabled = 1,@freq_type =1,@freq_interval =
    1,@freq_subday_type = 0,@freq_subday_interval = 0,@active_start_date =
    20081112,@active_start_time = 173000,@freq_recurrence_factor = 0
    here is the log file snapshot
    2008-11-12 17:30:01.42 spid83      DBCC TRACEON 3605, server process ID (SPID) 83. This is an informational message only; no user action is required.
    2008-11-12 18:21:59.35 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 18:21:59.35 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 18:21:59.62 spid85      Error: 18204, Severity: 16, State: 1.
    2008-11-12 18:21:59.62 spid85      BackupDiskFile::OpenMedia: Backup device 'E:\SAPMSQLbackup\DBNOV.bak' failed to open. Operating system error 32(The process cannot access the file because it is being used by another process.).
    2008-11-12 18:22:09.73 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 18:22:09.73 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 18:22:09.85 spid85      Error: 18204, Severity: 16, State: 1.
    2008-11-12 18:22:09.85 spid85      BackupDiskFile::OpenMedia: Backup device 'E:\SAPMSQLbackup\DBNOV.bak' failed to open. Operating system error 32(The process cannot access the file because it is being used by another process.).
    2008-11-12 18:24:05.09 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 18:24:05.09 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 18:24:05.18 spid85      Error: 18204, Severity: 16, State: 1.
    2008-11-12 18:24:05.18 spid85      BackupDiskFile::OpenMedia: Backup device 'E:\SAPMSQLbackup\DBNOV.bak' failed to open. Operating system error 32(The process cannot access the file because it is being used by another process.).
    2008-11-12 18:24:07.40 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 18:24:07.40 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 18:24:07.56 spid85      Error: 18204, Severity: 16, State: 1.
    2008-11-12 18:24:07.56 spid85      BackupDiskFile::OpenMedia: Backup device 'E:\SAPMSQLbackup\DBNOV.bak' failed to open. Operating system error 32(The process cannot access the file because it is being used by another process.).
    2008-11-12 18:24:09.03 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 18:24:09.03 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 18:24:09.15 spid85      Error: 18204, Severity: 16, State: 1.
    2008-11-12 18:24:09.15 spid85      BackupDiskFile::OpenMedia: Backup device 'E:\SAPMSQLbackup\DBNOV.bak' failed to open. Operating system error 32(The process cannot access the file because it is being used by another process.).
    2008-11-12 18:24:11.51 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 18:24:11.51 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 18:24:11.65 spid85      Error: 18204, Severity: 16, State: 1.
    2008-11-12 18:24:11.65 spid85      BackupDiskFile::OpenMedia: Backup device 'E:\SAPMSQLbackup\DBNOV.bak' failed to open. Operating system error 32(The process cannot access the file because it is being used by another process.).
    2008-11-12 18:25:08.59 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 18:25:08.61 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 18:25:20.51 spid89      DBCC TRACEON 3605, server process ID (SPID) 89. This is an informational message only; no user action is required.
    2008-11-12 18:25:27.00 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 18:25:27.00 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 18:32:26.91 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 18:32:26.91 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 18:32:27.05 spid85      Error: 18204, Severity: 16, State: 1.
    2008-11-12 18:32:27.05 spid85      BackupDiskFile::OpenMedia: Backup device 'E:\SAPMSQLbackup\DBNOV.bak' failed to open. Operating system error 32(The process cannot access the file because it is being used by another process.).
    2008-11-12 18:36:51.51 spid91      DBCC TRACEON 3605, server process ID (SPID) 91. This is an informational message only; no user action is required.
    2008-11-12 18:36:51.51 spid91      DBCC TRACEON 3605, server process ID (SPID) 91. This is an informational message only; no user action is required.
    2008-11-12 18:36:51.65 spid91      Error: 18204, Severity: 16, State: 1.
    2008-11-12 18:36:51.65 spid91      BackupDiskFile::OpenMedia: Backup device 'E:\SAPMSQLbackup\DBNOV.bak' failed to open. Operating system error 32(The process cannot access the file because it is being used by another process.).
    2008-11-12 18:37:12.04 spid91      DBCC TRACEON 3605, server process ID (SPID) 91. This is an informational message only; no user action is required.
    2008-11-12 18:37:12.04 spid91      DBCC TRACEON 3605, server process ID (SPID) 91. This is an informational message only; no user action is required.
    2008-11-12 18:37:12.16 spid91      Error: 18204, Severity: 16, State: 1.
    2008-11-12 18:37:12.16 spid91      BackupDiskFile::OpenMedia: Backup device 'E:\SAPMSQLbackup\DBNOV.bak' failed to open. Operating system error 32(The process cannot access the file because it is being used by another process.).
    2008-11-12 18:37:21.02 spid91      DBCC TRACEON 3605, server process ID (SPID) 91. This is an informational message only; no user action is required.
    2008-11-12 18:37:21.04 spid91      DBCC TRACEON 3605, server process ID (SPID) 91. This is an informational message only; no user action is required.
    2008-11-12 18:37:21.18 spid91      Error: 18204, Severity: 16, State: 1.
    2008-11-12 18:37:21.18 spid91      BackupDiskFile::OpenMedia: Backup device 'E:\SAPMSQLbackup\DBNOV.bak' failed to open. Operating system error 32(The process cannot access the file because it is being used by another process.).
    2008-11-12 18:44:44.23 spid92      DBCC TRACEON 3605, server process ID (SPID) 92. This is an informational message only; no user action is required.
    2008-11-12 18:45:24.42 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 18:45:24.42 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 18:45:24.42 spid85      Error: 18204, Severity: 16, State: 1.
    2008-11-12 18:45:24.42 spid85      BackupDiskFile::OpenMedia: Backup device 'E:\SAPMSQLbackup\test.bak' failed to open. Operating system error 2(The system cannot find the file specified.).
    2008-11-12 18:45:32.78 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 18:45:32.78 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 18:45:32.78 spid85      Error: 18204, Severity: 16, State: 1.
    2008-11-12 18:45:32.78 spid85      BackupDiskFile::OpenMedia: Backup device 'E:\SAPMSQLbackup\test.bak' failed to open. Operating system error 2(The system cannot find the file specified.).
    2008-11-12 18:45:39.70 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 18:45:39.70 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 18:45:39.84 spid85      Error: 18204, Severity: 16, State: 1.
    2008-11-12 18:45:39.84 spid85      BackupDiskFile::OpenMedia: Backup device 'E:\SAPMSQLbackup\DBNOV.bak' failed to open. Operating system error 32(The process cannot access the file because it is being used by another process.).
    2008-11-12 19:50:27.41 Backup      Database backed up. Database: SID, creation date(time): 2008/05/07(18:32:21), pages dumped: 26905751, first LSN: 9854:10543:202, last LSN: 9854:18731:1, number of dump devices: 1, device information: (FILE=1, TYPE=DISK: {'USBDB'}). This is an informational message only. No user action is required.
    2008-11-12 19:50:27.55 spid83      DBCC TRACEON 3605, server process ID (SPID) 83. This is an informational message only; no user action is required.
    2008-11-12 21:25:21.51 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 21:25:21.60 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 21:27:40.86 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    2008-11-12 21:27:40.86 spid85      DBCC TRACEON 3605, server process ID (SPID) 85. This is an informational message only; no user action is required.
    exec msdb..sp_add_jobserver  @job_name = 'SAP CCMS Full DB Backup of SID
    [20081112160619-3-173000]',@server_name = '(local)'
    thanks a lot for your time
    Mani

  • MSSQL JDBC driver missing for installation of NW '04 SR1

    Hi all,
    during the installation of NW '04 SR1/EP6 on a system running MSSQL Server 2000 SP4 SAPinst crashes with the following error:
    ERROR 2007-03-06 22:33:34
    MDB-05800  <html>Cannot find jdbc driver for MS SQL Server</html>
    I searched this forum, the notes and asked Dr. Google but to no avail. Can anybody give me a hint what's the problem, please?
    Best regards,
    Bernd

    Thanks a lot for your help Dan! Your suggestion has shown me the right direction. As I wrote the directory you mentioned was indeed missing. I copied it from another installation and it worked.
    At least it seemed to work, but I've got another problem concerning the database connection during the installation. While performing the step "Load Java Database content" SAPinst crashes again with the following output:
    com.sap.inst.jload.Jload main
    SEVERE: couldn't connect to DB
    com.sap.sql.log.OpenSQLException: Could not load class com.ddtek.jdbc.sqlserver.SQLServerDriver.
    The strange thing is that I found two different SQL driver on the machine with the working installation! One was located in the installation media directory, the files WebAS is working with are obviously another version, because they have significantly different files sizes!
    Does someone have a hint which versions of SQL Server and driver files do work together?

  • Not able to get the connection to mssql server thro native sql

    Dear Experts,
               I have created a database connection to mssql server thro DBCO t.code.Am not able to get the connection when i am executing Native SQl for geting connection of mssql server.
    DATA: CON_NAME LIKE DBCON-CON_NAME VALUE 'BIW'.
    EXEC SQL.
      CONNECT TO :con_name AS 'C1'
    ENDEXEC.
    Am always getting sy-subrc = 4. The user name and password i have given in dbcon table having full authorization to access mssql database. I am working SAP ecc 5.0. Also both servers are running in windows.
    could anyone hlep me on this issue.
    Thanks in advance.

    Hello, the submitted error must be analyzed according to the Syntaxis and characteristics of the MSSQL database. See explanation of error.
    http://doc.ddart.net/mssql/sql2000/html/trblsql/tr_reslsyserr_1_1o1i.htm
    Error 156
    Severity Level 15
    Message Text
    Incorrect syntax near the keyword '%.*ls'.
    Explanation
    This error indicates that the syntax of a Transact-SQL statement is incorrect and that the syntax error was detected near the keyword specified in the error message. The most frequent causes for syntax errors are misspellings of Transact-SQL keywords or operators, and specifying the syntax of a Transact-SQL statement in the wrong order.
    One of the more complicated causes for this error may be a compatibility level mismatch for the current database. If the current database has a compatibility level other than 70, Microsoft® SQL Serveru2122 will not recognize any of the keywords that a database with a compatibility level of 70 would recognize.
    Action
    First, check the Transact-SQL statement syntax near the keyword specified in the error message. Because Transact-SQL language syntax can be very complex, SQL Server may incorrectly report the position of the syntax error as later in the Transact-SQL statement than it actually occurred. Second, reexamine the entire Transact-SQL statement that generated the error. Verify the syntax order of the statement.
    Ensure that the database does not have a compatibility level of 65 and has a compatibility level of 70.

  • Trying to move EP 7.0 from one MSSQL server to a different one

    We have created a distributed instance installation of NW2004s/EP7.0.
    We need to move the database instance from one windows server to a second server.  We do not need to move any other portions.
    We shutdown the MSSQL server and copied the files, and brought the database up.  To test I connected to the database using query analyzer, and the user which is defined as SAP<SID>DB (in our case SAPSPPDB) and this worked fine.
    When I adjust the default profile parameter, and the config tool parameter - in the secure store: jdbc/pool/<SID>/URL.  The changes were done after teh database was shutdown and copied.  I get errors afterwards jcontrol fails, online and offline config tool do not open, etc'
    What is the process for moving a MSSQL database from a portal?

    I did it a few times succesfull and this is (my) procedure:
    1. stop the SAP system
    2. detach th DB on the Source server
    3. copy db+log files to the Target server
    4. attach the db on the Target server
    5. repair login/db user account following the steps:
    -  http://support.microsoft.com/kb/274188
    OR
    -  http://blog3.daqureshi.com/archive/2008/12/16/11.aspx
    6. update/change the file usr\sap\<sid>\sys\profile\default.prf
    7. start the configtool and within the keystore change the jdbc connection parameters so that it points to the new DB Server
    8. save this action!!!!
    9. exit and restart the configtool and look if its connecting to the new DB Server
    10. exit the confconfigtool.
    11. start your SAP System
    Good Luck!
    Benjamin Houttuin

  • Password Change on MSSQL Server, now no Connection to Workspace

    Hello,
    our IT-Department changed the password to login to the MSSQL Server. Now i cant login to Workspace or Financial Reporting. The Error message says the the GSM Service on Port 1800 cant be reached. The Services are marked as started.
    I have already used the Configuration Utility and the Service Configurator, there is a tab called database where you can change the login credentials. But i still cant login.
    There is a note below which says:
    Note: Database properties are tied to some startup scripts and configuration files. If you make any changes on these properties you should change those related files per hand.
    Which Files are meant ?
    Where else is the password stored ?
    What else can i do to check if the GSM Service is running ?
    Thx for your help
    I forgot to say we use an 9.2 enviroment on win2k3 servers.
    Edited by: Kevin Kraft on 01.10.2009 08:39

    Hello,
    i talked to support an they gave me the advise to restore the old password to get services running and then do the following steps:
    Changing the Services Repository Database Password
    When you change the password that the services use to access the repository database, the order
    of steps is critical. Carefully read all instructions before performing them.
    Caution!
    Make sure to change the password in Workspace before changing it in the database. If you
    perform the steps in the wrong order, you may lose the ability to run Workspace.
    ➤ To change the repository database password:
    1 From RSC, select Name Service, Repository Service, or Event Service.
    2 Click Show item properties, and select the Storage tab.
    3 Change the password and click OK.
    4 Repeat step 1 through step 3 for all Name Services, Repository Services, and Event Services with the same
    database account, making certain to enter the same password for each one.
    If these services use different database accounts, perform this step only for those that use the
    account whose password you are changing.
    5 Close RSC.
    6 In LSC, click Show host properties, and select the Database tab.
    7 Change the password and click OK.
    This password property (like the other properties on the Database tab) applies to all LSC services
    on the local host, all of which use one database account.
    For more information about LSC, see Chapter 8, “Configuring LSC Services.”
    8 Repeat step 6 and step 7 on every host that contains LSC services, making certain to enter the password
    the same way each time.
    9 If you are using the same database for row-level security, change the password for row-level security from
    the Administer module.
    10 Stop the Reporting and Analysis services.
    11 Change the password in the database, making certain it matches the password entered for Reporting and
    Analysis services.
    12 Restart the services.
    This procedure can also be found in the file hsadmin.pdf which is the Workspace Administration Guide.
    My Problem is the IT-Department cant restore the old password, so i fear i have to reinstall the services :(.
    thx for your help
    Kevin

  • Problem with DG4ODBC and MSSQL

    Oracle 11g XE, Apex 4.2.3 with DG4ODBC connecting to MSSQL Express on Windows 7.
    The above configuration gives poor performance (slow or no response).
    Simple queries work - "select itemname from tablea@dblink"
    Minor complex queries (and above ??) do not work - "select a.itemname from tablea@dblink a, tableb@dblink b where a.id=b.id"
    Important other information:
    On the same machine there is a Windows 7 VM running with Oracle 10g XE, Apex 4.1.1- with HSODBC connecting to the MSSQL Express  on the host.
    The application has a page with multiple regions and more complex queries (join, count, in list) and it loads normally.
    There are none of the issues experienced with the 11g/4.2 mix.
    Is there a tweak/patch to make the 11g/4.2 function as well as the 10g/4.1 (will settle for equal performance) ?

    Sounds like there are lots of moving parts there.
    All bits running on the same host? Hope its got plenty of memory ... using NAT or a bridging setup for the VM NIC(s)?
    So in the XE guest, there is a tnsalias with an ...HS=OK... stanza? And listener running at the Express host with the dg4odbc setup?
    Is there much difference in timing for a tnsping <tnsalias> and a sqlplus ... conn <user>@tnsalias with set timing on?

  • MSSQL Server 2012. Error accessing reporting website. Not Found The requested URL /ReportServer1 was not found on this server. Unable to uninstall MSSQL 2008

    Hi all. I have recently installed MSSQL Server 2008, and was not able to access the URL when I clicked on it. It gave me a 404.
    When I installed 2012, I tried the same thing and it also throws me a 404 error. How should I go about solving this? What are the log files that you may need to help me solve this?
    At the same time, I have also tried to uninstall my 2008, but am always stuck at not being able to remove Client Connectivity Tools and some other components. Please let me know what log files you need and I will be happy to provide them. Thanks!
    The following is the log for the uninstallation.
    Overall summary:
      Final result:                  Failed: see details below
      Exit code (Decimal):           -2068052368
      Exit facility code:            1212
      Exit error code:               1648
      Exit message:                  Failed: see details below
      Start time:                    2014-04-11 09:40:30
      End time:                      2014-04-11 09:41:37
      Requested action:              Uninstall
      Log with failure:              C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20140411_093720\sql_tools_Cpu64_1.log
      Exception help link:           http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=10.50.1600.1
    Machine Properties:
      Machine name:                  ADC-PC
      Machine processor count:       8
      OS version:                    Windows 7
      OS service pack:               Service Pack 1
      OS region:                     Singapore
      OS language:                   English (United States)
      OS architecture:               x64
      Process architecture:          64 Bit
      OS clustered:                  No
    Product features discovered:
      Product              Instance             Instance ID                    Feature                
                     Language             Edition              Version         Clustered 
      Sql Server 2008 R2                                                       Management Tools - Basic      
                                   Enterprise Edition   10.50.1617.0    No        
      Sql Server 2008 R2                                                       Management Tools - Complete    
                                  Enterprise Edition   10.50.1617.0    No        
      Sql Server 2008 R2                                                       Client Tools Connectivity      
                                  Enterprise Edition   10.50.1617.0    No        
    Package properties:
      Description:                   SQL Server Database Services 2008 R2
      ProductName:                   SQL Server 2008 R2
      Type:                          RTM
      Version:                       10
      SPLevel:                       0
      Installation edition:          EVAL
    User Input Settings:
      ACTION:                        Uninstall
      CONFIGURATIONFILE:             C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20140411_093720\ConfigurationFile.ini
      ENU:                           False
      FARMACCOUNT:                   <empty>
      FARMADMINPORT:                 0
      FARMPASSWORD:                  *****
      FEATURES:                      CONN,SSMS,ADV_SSMS,CE_TOOLS,BROWSER,WRITER
      HELP:                          False
      IACCEPTSQLSERVERLICENSETERMS:  False
      INDICATEPROGRESS:              False
      INSTANCEID:                    <empty>
      INSTANCENAME:                  <empty>
      PASSPHRASE:                    *****
      QUIET:                         False
      QUIETSIMPLE:                   False
      UIMODE:                        Normal
      X86:                           False
      Configuration file:            C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20140411_093720\ConfigurationFile.ini
    Detailed results:
      Feature:                       SQL Writer
      Status:                        Passed
      MSI status:                    Passed
      Configuration status:          Passed
      Feature:                       SQL Browser
      Status:                        Failed: see logs for details
      MSI status:                    Failed: see details below
      MSI error code:                0x1648
      MSI log file location:         C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20140411_093720\sql_tools_Cpu64_1.log
      MSI error description:         
      Configuration status:          Passed
      Feature:                       SQL Compact Edition Tools
      Status:                        Failed: see logs for details
      MSI status:                    Failed: see details below
      MSI error code:                0x1648
      MSI log file location:         C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20140411_093720\sql_tools_Cpu64_1.log
      MSI error description:         
      Configuration status:          Passed
      Feature:                       Client Tools Connectivity
      Status:                        Failed: see logs for details
      MSI status:                    Failed: see details below
      MSI error code:                0x1648
      MSI log file location:         C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20140411_093720\sql_tools_Cpu64_1.log
      MSI error description:         
      Configuration status:          Passed
      Feature:                       Management Tools - Complete
      Status:                        Failed: see logs for details
      MSI status:                    Failed: see details below
      MSI error code:                0x1648
      MSI log file location:         C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20140411_093720\sql_tools_Cpu64_1.log
      MSI error description:         
      Configuration status:          Passed
      Feature:                       Management Tools - Basic
      Status:                        Failed: see logs for details
      MSI status:                    Failed: see details below
      MSI error code:                0x1648
      MSI log file location:         C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20140411_093720\sql_tools_Cpu64_1.log
      MSI error description:         
      Configuration status:          Passed
    Rules with failures:
    Global rules:
    There are no scenario-specific rules.
    Rules report file:               C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20140411_093720\SystemConfigurationCheck_Report.htm

    Strange, but finally the procedure below did solve my problem.
    # Go to Control Panel > Add or Remove Programs and look for '''Anti Phishing Domain Advisor'''.
    # If you click on ''Click here for support information'' you'll see it is a Panda program.
    # Uninstall '''Anti Phishing Domain Advisor''' program...
    # This did solve my problem
    See also [https://support.mozilla.com/en-US/questions/811399#answer-205531 Can't open mail. Get this message: 404 Not Found nginx/0.6.32]

  • Which LKM and IKM to use for Fast data loading b/w MSSQL 2005 and Oracle 11

    Hi,
    Can anybody help us to decide which LKMs and IKMs are best for data loading between MSSQL and Oracle.
    Staging Area is Oracle. We have to load around 400Million rows from MSSQL to Oracle 11g.
    Best regards,
    Muhammad

    Thanks Ayush,
    You are right and it has dumped the file very quickly; but it is giving error on sqlldr call thorugh jython. I have reaised SR with oracle to look into it further.
    thanks again and have a very nice time.
    Regards,
    Muhammad

  • Mssql single quote problem!

    Hi,
    I user servlet to update MS SQL2000. My problem is there is a single quote inside a text string!
    I can't use double quote for string, as it is not a valid statement for MSSQL. I need to use single quote, but there is single quote inside the string, how can I handle the string?
    String mstrnig="I'm a boy";
    String mSQL = "UPDATE news SET " + "title='" + mstring + "' WHERE code =" + mcode;
    Thanks

    the cleanest and easiest soln is to use preparedStatement.
    PreparedStatement ps = con.prepareStatement("update table comment=? where id = ?");
    ps.setString(1,"That's way to do it");
    ps.setInt(1,8);//some itn value
    ps.execute();

  • Warning: Index does not exist in database system MSSQL

    Hi,
    After activating the Index from SE11,
    I receive the following Warning:
    Index does not exist in database system MSSQL.
    What does this mean? Has performance been increased or does the index 1st have to exist in the database system MSSQL?

    When you create index at SE11 and you need activate database utility.
    utilitities-database utility->then click activate and adjust database.
    else you can use SE14 and so that Index will create databse level.
    Reward Points if it is helpful
    Thanks
    Seshu

Maybe you are looking for

  • Ipad and ipad mini on same account won't facetime

    Ipad and ipad mini on same account won't facetime.  Already added different e-mail account but to no avail.

  • Customs components are not updated on the scene

    Hello! i am working on a simple component, it is a movie clip. On each frames I have a label and an icon. In the component properties I set up a list where every itemshas the same title as the frames's labels. With this component I can set any icon I

  • Update Organisation

    Hello, I would like to update the organizational structure, e.g. change the assignment of an org. unit. I tended to use the function module OM_CREATE_NEW_RELATIONS. But then I read in this forum, that the function module RH_RELATION_MAINTAIN is "stra

  • Can't edit text using "Add text" tool

    Hello, I click "Add Text" in "Content Editing" and add some text into a PDF document. Then, I save the pdf. Then, I re-open the document and I can't edit the same text using the same "Add Text" tool OR delete that piece of text.

  • Failure to export to PDF

    I have an InDesign file that I exported an earlier version of to a PDF with no problem, but now it fails to export.  I've installed Adobe updates but it hasn't helped.