I have SQL server and SQL management studio 2012. After i create tables and when i export the data base to the server "online" every "primary and auto incremental" field become as a normal field. so when i try to add row to database i have the following error
"Cannot insert the value NULL into column 'taskID', table 'lawyersDB.dbo.tasks'; column does not allow nulls. INSERT fails.
The statement has been terminated."
To solve this problem i have to manage the database "online" and go to each table and set again the fields primary and auto incremental. Since i have many tables, this process takes lot of time.
So Any idea to solve this problem!?
Note: my hosting is on Arvix company server
This is SQL Management Studio, not your account.
Try this:
You need to set this, or else if you have a non-nullable column, with no default error, if you provide no value it will error.
To set up auto-increment in SQL Server Management Studio:
Open your table in Design
Select your column and go to Column Properties
Under Indentity Specification, set (Is Identity)=Yes and Indentity Increment=1
Related
I have a database in Oracle and a database in SQL Server.
I want to write a query in Oracle and I need to use one of SQL Serever table in it.
Before I used database link but now I must to do this with ODI (Oracle Data Integrator).
The way I used before:
CREATE PUBLIC DATABASE LINK "DBLINK"
CONNECT TO "MatrisApp" IDENTIFIED BY VALUES ':1'
USING 'dg4msql';
INSERT
INTO everyday_deposit_temp ***/*this is a table in oracle*/***
(
"DEP_ID",
"REF_DEPOSIT_TYPE",
"REF_DEPOSIT_SUB_TYPE",
"LEDGER_CODE_SELF"
)
SELECT "DEP_ID",
"REF_DEPOSIT_TYPE",
"REF_DEPOSIT_SUB_TYPE",
"LEDGER_CODE_SELF"
FROM dbo.vw_deposit_changed#dblink
Please help me with this
The most common way to get data from MS SQL Server to Oracle through ODI is to use LKM MSSQL to ORACLE (BCP SQLLDR).
Now if you really want to use a dblink, I would try this approach:
Duplicate a Oracle IKM you want to use
In the definition tab, check the Multi-Connections checkbox and set Microsoft SQL Server for the Source Technology.
In the Options tab, add a new option DBLINK_NAME with Value type.
In the Tasks tab, find the task responsible of the insert and edit the target command to add this after the table name : #<%=odiRef.getOption("DBLINK_NAME")%>
Create a mapping using the new IKM. In the Physical tab, click on the target table and add the dblink name in the Option.
I am trying to convert and migrate an Oracle schema to MSSQL server. At the last step, migrating data, I get the error message:
The table [MYDATABASE].[MYSCHEMA].MYTABLE] doesnot exist in target. You must first convert the table then load it into the database.
This error message appears for each table in my schema.
Can someone explain what is happening and what I need to do to get past this?
Are you tries to migrate the data before doing the ‘synchronize with the database’ operation?
If Yes,
This error message generally occurs when the target table doesn’t
exist on SQL server database. After converting schema, you need to
synchronize the table with the database before migrating the data.
To do this you right click on the SQL Server database in Metadata
explorer and click “Synchronize with database” menu.
Note: Table structure will not be created in the SQL server database until you synchronize.
From the Object Explorer of SQL Server Management Studio I renamed a table from nameA to nameB. When I query SELECT * from nameB I receive the error
object name 'nameA' not valid
This happens both from Management Studio and an external application. SELECT * from nameA gives the same error.
Restarting the service didn't help. Table name in sysobjects is correct. Is there maybe another place where SQL Server looks up table names? Thanks, it's getting me quite crazy :S
I'm using SQL Server 11.0.2100.60
Solved with a workaround:
I generated scripts for table schema and data, dropped the table and run scripts to recreate table schema and data. NOTE: I needed to manually modify the generated scripts because of mistakes in smalldatetime fields which made the generated INSERTs fail.
So it seems that dropping tables resets the "denormalized" SQL Server internal catalog which was left inconsistent somewhen. Thanks MS! ;)
I am trying to restore a SQL Server 2014 database in SQL Server 2005. I am doing by generating the complete script (with schema and data) from SQL Server 2014.
I get an error saying
'INSERT failed because the following SET options have incorrect settings: 'ANSI_PADDING'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or query notifications and/or xml data type methods.'
and
'Cannot insert explicit value for identity column in table 'T_GASAdminNote' when IDENTITY_INSERT is set to OFF.'
I have searched for solution but have not been able to rectify the problem. I have tried the solution given in this link, but it didn't help me.
Can anyone suggest me some solutions for restoring the database.
Update: sorry - misread your question...
The first error means just that - for some operation you're trying to do, your SET ANSI_PADDING setting is wrong. Read the official documentation on ANSI_PADDING on MSDN to learn more about this setting. Check what your setting is now - obviously, if that error occurs, you need the other setting for that operation you're attempting to do.
The second error means that your table T_GASAdminNote has an identity column, and you're trying to insert values into that column, but without first enabling this by using SET IDENTITY_INSERT T_GASAdminNote ON (and don't forget to disable the option after you're done!)
I am using sql server 2008.i have one ABC database on A server(source).now i want to copy all the schema and data of this database to my new database XYZ on B server(destination).for this i am using sql server import wizard.
now the scenario is:
In ABC database,many tables have identity columns as primary key.when i use import wizard, i set "Enable identity insert" to True(checked).
but import process completes,i found that destination tables are created but primary keys are not set for tables and also identity is also not set.
It just copies the data,not the Primary keys or identity fields.
How to make it possible to work for "identity insertion" for all tables
Pls help.thanks in advance.
If you want to copy entire database better try Copy Database wizard, not Import/Export. This feature just copies data. Enable identity insert just tells the wizard to use SET IDENTITY_INSERT ON/OFF commands when inserting data to columns with IDENTITY - it doesn't set the IDENTITY parameter of the column.
try using these
SQL SCHEMA Comparison:
http://www.codeproject.com/KB/database/SQLCompare.aspx
SQL DATA Comparision
http://www.codeproject.com/KB/database/DataCompareTool.aspx