Update data automatically in sql server 2005 based on condition proplem

Hi guys i have problem I have two table
First one is
Second One is Vacation
as relation one to many (vacation has foreign key of Contract No OF Table Contract) 
what i need is to update Contract table with field status =Finish where start vacation date >end contract Date
How i do that in sql server 2005 to make update automatically
Ex
contract table
status             nvarchar(20)
end contract    date time
vacation table
start vacation date time
end vacation date time
start vacation date is 23/10/2014
and End
is 26/10/2014
Now not update status in contract table to finish because vacation date start is less from end contract
but when date today is 27/10/2014 update contract table field status to finish
automatically with sql server 2005 
How i do that condition to make update to data automatically based on changing on date
Update statement i need is 
update Contract set status = finish where start vacation>end contract
but problem how i write this statement to update data automatically based on date today

Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Temporal data should
use ISO-8601 formats. You failed again. Code should be in Standard SQL as much as possible and not local dialect. 
This is minimal polite behavior on SQL forums. Now we have to write the DDL that you did not bother with! What you did post was wrong! There is no key or constraints. There is no generic “status” in RDBMS; a "<something in particular>_status"
is a state of being, so it needs a temporal duration. The correct idiom for this data model is: 
CREATE TABLE Vacations
(vacation_contract CHAR(15) NOT NULL PRIMARY KEY,
 vacation_start_date DATE NOT NULL,
 vacation_end_date DATE,
 CHECK(vacation_start_date < vacation_end_date),
Oh, a field is nothing like a column. You need to read a basic SQL or RDBMS book; you do not know the basics. 
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL

Similar Messages

  • INSERTING DATA INTO A SQL SERVER 2005 TABLE, WHICH HAS A IDENTITY COLUMN

    Hi All,
    I have to insert the data into a SQL SERVER 2005 Database table.
    I am able to insert the data into a normal SQL Server table.
    When I am trying to insert the data into a SQL Server table, which has a identity column (i.e. auto increment column in Oracle) I am getting error saying that can't insert value explicitly when IDENTITY_INSERT is set to OFF.
    Had anybody tried this??
    There are some SRs on this issue, Oracle agreed that it is a bug. I am wondering if there is any workaround from any one of you (refer Insert in MS-SQL database table with IDENTITY COLUMN
    Thanks
    V Kumar

    Even I had raised a SR on this in October 2008. But didn't get any solution for a long time, finally I had removed the identity column from the table. I can't to that now :).
    I am using 10.1.3.3.0 and MS SQL SERVER 2005, They said it is working for MS SQL SERVER TABLE, if the identity column is not a primary key and asked me to refer to note 744735.1.
    I had followed that note, but still it is not working for me.
    But my requirement is it should work for a MS SQL SERVER 2005 table, which has identity column as primary key.
    Thanks
    V Kumar

  • Automating Data Migration from SQL Server 2005

    Hi All,
    I need to migrate data from SQL Server 2005 to Oracle DB ( Datawarehouse). The data migration involves updating Dimensions and Fact table. I have got painful job of switching topology to point to over 100 different weekly SQL DBs ( in sequence) and pull the data into DW. How can I automate my ODI process to switch from one after the other.
    Any Ideas?
    KS

    ODI Variables are there to help you with this. Please go through this post at [http://blogs.oracle.com/dataintegration/2009/05/using_odi_variables_in_topolog.html] .
    This will show you how to use a variable Oracle data server.
    On similar lines you should be able to switch to any of your 100 weekly SQL server DBs.
    And loop in a sequence to load data from all of them.
    Hope that helps

  • Error in adding PRIMARY Data file of SQL Server 2005

    Hi Experts,
    I am using SQL 2005 as back end database for SAP ECC6. Due to Space problem in PRD data volume, i have added PRDDATA4.ndf file in SSMS ( SQL Server Management Studio) and saved. But, suddenly i got one more idea and extended the file size of exisiting PRDDATA1.mdf, PRDDATA2.ndf & PRDDATA3.ndf immediately i removed the PRDDATA4.ndf file before starting the service. But, while seeing in SAP using ST04 it showing the PRDDATA4.ndf with error message of file missing. What i have to do now? How can i delete the information showing in ST04. But it is not showing in SSMS.
    Please help how to solve this.
    Regards,
    B.Sudharsan

    Hi,
    Following solution might help you to resolve the issue.
    Solution1:
    Issue happens because universe connection to the Database is not responding and the Data Source Name is not configured to write SQL Server 2005 database.
    Resolution
    Created new DSN connection under SYSTEM DSN to SQL Server 2005 Database.
    Import the universe from the designer.
    Go to File->Parameters.
    Edit Connection.
    On the Database Middleware Page expand SQl Server 2005->Select SQL Server 2005 driver.
    Change the DSN to new DSN connection
    Test the connection.
    Save the Universe and Export it to the repository.
    Solution2:
    I am taking Oracle as an example over here.
    This can be caused when the SQLNET.ora is located in a remote location using mapped drives.
    Resolution
    To resolve,
    check the registry [HKLM\SOFTWARE\ORACLE] you should see a folder called HOME0
    look for any paths that contain a mapped drive partition
    Change the mapped drive letter to a UNC path (
    server\folder)
    Open a command prompt and do a tnsping using the tnsname and verify the location of the SQLNET.ora or TNSNAMES.ora
    If the path is not updated to the new path
    Reboot the server
    Regards,
    Sarbhjeet Kaur

  • Cannot set up data source for SQL Server 2005

    Is it possible to use Microsoft's Beta 2 version of the SQL Server 2005 JDBC driver with WebLogic 9.0? I've downloaded the driver and added it to my server classpath, but when I try to create a new data source using the admin console, the drop-down list for Microsoft SQL Server only contains drivers for the 2000 version. If I select "Other" from the list and try to move on, I get a cryptic, page-long error on the admin console. If I just select the 2000 driver and try to manually modify the parameters on the next set of screens, I still get errors when I try to test the configuration. I've successfully used a third-party driver before, but this one does not seem to be working. Any help would be greatly appreciated.
    Regards,
    Sabrina

    SabrinaL wrote:
    Is it possible to use Microsoft's Beta 2 version of the SQL Server 2005 JDBC driver with WebLogic 9.0? I've downloaded the driver and added it to my server classpath, but when I try to create a new data source using the admin console, the drop-down list for Microsoft SQL Server only contains drivers for the 2000 version. If I select "Other" from the list and try to move on, I get a cryptic, page-long error on the admin console. If I just select the 2000 driver and try to manually modify the parameters
    on the next set of screens, I still get errors when I try to test the configuration. I've successfully used a third-party driver before, but this one does not seem to be working. Any help would be greatly appreciated.
    Regards,
    SabrinaHere I describe the steps I took to bypass the console in making a new pool.
    1 - Edit the script %DOMAIN_HOME%\bin\startWebLogic.cmd to add a line like this:
    set CLASSPATH=%CLASSPATH%;\new_ms_driver\beta2\sqljdbc_1.0\enu\sqljdbc.jar
    In other words, you have to explicitly add a third party driver's classes to
    the CLASSPATH that will be in effect for the server. Just adding the driver
    to your window's class path will do nothing.
    2 - Go to the directory %DOMAIN_HOME%\config\jdbc, where you will find
    files of the name *-jdbc.xml. Each of these represents a DataSource.
    Copy one of them, perhaps either examples-demo-jdbc.xml, or
    examples-demoXA-jdbc.xml depending on whether you want to make an XA
    or non-XA pool. Make you new file's name like the name of the DataSource,
    still ending in -jdbc.xml. Eg: MS_Beta-jdbc.xml
    3 - Edit this file to change as much as would be clear for the
    driver you want. Eg: change the driver class to the class you want,
    the user name, URL, test table etc. Also, change the pool's initial
    capacity to 0. This is so the pool can be created without making a
    connection. We need that because the password is encrypted, and
    there is no manual way for you to add the correct one yet.
    4 - go one directory up, and edit the config.xml. Find a
    jdbc-system-resource entry corresponding to the original
    resource file you copied. Make a new entry in the config file,
    like the original, but change the Datasource name to your new one.
    5 - If this all went well, reboot your server and go to your data
    source in the console, and edit it. Alter the password to what it
    really should be, and you can also change whatever else you might
    want.
    6 - shut down again, and reboot, and you should then be able to go to
    your data source in the console and test a connection.
    That's it. Here is an example of a jdbc.xml file I made, and
    the entry I made in the config.xml:
    config/jdbc/newpool-jdbc.xml:
    <?xml version='1.0' encoding='UTF-8'?>
    <jdbc-data-source xmlns="http://www.bea.com/ns/weblogic/90" xmlns:sec="http://www.bea.com/ns/weblogic/90/security"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wls="http://www.bea.com/ns/weblogic/90/security/wls"
    xsi:schemaLocation="http://www.bea.com/ns/weblogic/90/domain.xsd">
    <name>newpool</name>
    <jdbc-driver-params>
    <url>jdbc:sqlserver://frogger:1433</url>
    <driver-name>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-name>
    <properties>
    <property>
    <name>user</name>
    <value>joe</value>
    </property>
    </properties>
    <password-encrypted>{3DES}cPpx2Z6faqY=</password-encrypted>
    </jdbc-driver-params>
    <jdbc-connection-pool-params>
    <initial-capacity>1</initial-capacity>
    <max-capacity>5</max-capacity>
    <capacity-increment>1</capacity-increment>
    <shrink-frequency-seconds>900</shrink-frequency-seconds>
    <test-connections-on-reserve>true</test-connections-on-reserve>
    <test-table-name>SQL select 1</test-table-name>
    <profile-type>0</profile-type>
    </jdbc-connection-pool-params>
    <jdbc-data-source-params>
    <jndi-name>newpool</jndi-name>
    <global-transactions-protocol>TwoPhaseCommit</global-transactions-protocol>
    </jdbc-data-source-params>
    <jdbc-xa-params></jdbc-xa-params>
    </jdbc-data-source>
    config.xml entry:
    <jdbc-system-resource>
    <name>newpool</name>
    <target>examplesServer</target>
    <descriptor-file-name>jdbc/newpool-jdbc.xml</descriptor-file-name>
    </jdbc-system-resource>

  • Upgrade data base from sql server 2005 to sql server2008

    Hi guys,
    What is the best way for upgrade my SQL Server 2005 data base to SQL 2008?

    It depends on how you want migrate, in-place or side-by-side?
    In-place: Run a backup of all databases and then install the new SQL Server version
    Side-by-side: Install the new SQL Server, backup all database of old SQL Server and restore them on the new one. Then copy all logins from old to new server.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Error updating data source from SQL Server ODBC into SQL Native Client 10.0

    I am converting Crystal 8.5 reports into Crystal XI release 2. The data source was ODBC using SQL Server 2000 and pointing to a stored procedure. In the new server the data source has to be ODBC again, but it uses the SQL Native Client 10.0 Driver, because the new server is SQL Server 2008. I have copied the same old stored procedure on the new server and it works fine as a data source to a brand new Crystal XI report. But when I am opening an existing 8.5 version crystal report and updating the data source to the new location I get the error message "Some tables could not be replaced, as no match was found in the new data source".
    I thought I could tackle this error by creating a temporary data source using the standard ODBC SQL Driver linked to the SQL 2008 Server instead of the SQL Native Client 10 ODBC. So I first updated the crystal data source to link to this temp ODBC using SQL Driver and it worked fine. But after that, when I try to update the data source to link to the SQL Native Client 10 ODBC, I get the same error again.
    So I guess that the problem is not the new server itself, but the switch between SQL Server ODBC and SQL Native Client 10 ODBC.
    Does anyone know what's going on with this SQL Native Client 10 in updating crystal report data sources?

    CR XI does not support that driver. Try selecting the Native driver or upgrade to CR XI R2 for free and use SP4, 5 and 6 and then FP 6.4 or upgrade to CR 2008 and SP 3 and Fix Pack 3.3
    Thank you
    Don

  • SQL Server Policy Based Management Condition 'conditionname' cannot be used for filtering.

    Using SQL Server 2008 R2, I am trying to create a condition to be used as a filter at the database level.  So for each database, I would like to test the presence of a Database Extended Property using the following code in the Expression/Field:
    ExecuteSql('String', 'SELECT value FROM sys.extended_properties WHERE class_desc = ''Database'' AND name=''somepropertyname''')
    I created the condition using the Database Facet.
    The condition can be evaluated in a policy, but I cannot use the condition as a filter for a policy against the "Database" filter.  If I create a new condition that can be used as a filter and try to edit that condition, I receive the following
    error:
    "Condition 'conditionname' cannot be used for filtering."
    I cannot find any documentation on the limitations of filters.  I am assuming that ANY use of ExecuteSql would not be allowed.  This filter is important because I am testing the @IsEncrypted of Every StoredProcedure, Every Database.  If the
    database extended property is present, I want to skip the test.
    CorkChop

    Hi,  you resolved this issue? If yes, how?
    []'s | Rodrigo Ribeiro Gomes | MCTS/MCITP Dev/DBA

  • Why wont this update??Microsoft SQL Server 2005 Express Edition Service Pack 3 (KB955706)

    Everytime windows update downloads this it fails.
    Solved!
    Go to Solution.

    Download for SQL express SP3
    Cheers and regards,
    • » νιנαソѕαяα∂нι ѕαмανє∂αм ™ « •
    ●๋•کáŕádhí'ک díáŕý ツ
    I am a volunteer here. I don't work for Lenovo

  • Import data from Sql Server 2005

    We have a requirement where we need to import/access data from an Sql Server 2005 database into an Oracle 9i/10g database? Basically, the need is to create some link between Sql Server and Oracle database? In, case of two Oracle databases we could have used 'dblink' but how can we do the same in this case?
    Regards,
    Rup

    By using a feature called 'Heterogeneous Services' which interfaces with ODBC or oledb.
    Heterogeneous Services is documented in the 'Net administrators manual'.
    Sybrand Bakker
    Senior Oracle DBA

  • How to integrate from MS SQL SERVER 2005 and Flatfile to Oracle 10g.

    Hi
    I am new to ODI. I am trying to load sample data from MS SQL Server 2005 and Flatfile to Oracle 10g.
    1. I have created three models.
    1-1. SQL2005 (SRC_CUSTOMER table)
    1-2. Flatfile (SRC_AGE_GROUP.txt & SRC_SALES_PERSON.txt)
    1-3. Oracle 10g (TRG_CUSTOMER table)
    You may know I got those environments from the ODI DEMO environment.
    2. I could able to reverse the tables also.
    3. I have created an interface which contains source table (from MSSQL 2005), Flatfile and target table from ORACLE model.
    4. I have imported the knowledge modules. But I am confusing in selecting the knowledge modules to source and target tables.
    I've selected LKM File to SQL for flatfile model.
    I've also selected LKM SQL to SQL for MSSQL 2005 model and IKM Oracle Incremental Update for the target table (ORACLE).
    I've also implemented the interface that I created. It worked without errors. But there is no data in target table which is TRG_CUSTOMER.
    I really would like to know what happened and what the problems are.
    You can email me [email protected]
    Thanks in advance
    Jason Lee

    what did give for SRC_AGE_GROUP SRC_CUSTOMER join condition
    if it is
    (SRC_CUSTOMER.AGE=SRC_AGE_GROUP.AGE_MIN) AND SRC_CUSTOMER.AGE=SRC_AGE_GROUP.AGE_MAX
    give it as
    (SRC_CUSTOMER.AGE>SRC_AGE_GROUP.AGE_MIN) AND SRC_CUSTOMER.AGE<SRC_AGE_GROUP.AGE_MAX

  • Insert to XE from sql server 2005 ...

    Hi,
    is it possible to create a trigger on Sql Server 2005 to insert a row to Oracle XE ?
    I want to create a update/insert trigger on sql server 2005 which will insert the data into a Oracle XE table.
    I have a Linked Servers in Sql Server to Oracle XE and this link works with simple sql statement from sql server like :
    INSERT INTO [NEW_OR]..[Adam_user].[DUMMY] (AA) VALUES('Dummy String Data')
    But the same statement does not work when in trigger. the following error occurs in Sql Server 2005...
    Msg 8501, Level 16, State 3, Procedure deneme, Line 5
    MSDTC on server 'Adam_user' is unavailable.
    Any suggestions?
    Thanks in advance.....
    Adam

    Here is the answer...
    May be useful for someone who needs the same solution ...
    The Distributed Transaction Coordinator service must be start on windows to accomplish the transaction ...
    For this:
    (on windows)
    START > SETTINGS > CONTROL PANEL > ADMINISTRATIVE TOOLS > SERVICES. Find the service called 'Distributed Transaction Coordinator' and RIGHT CLICK (on it and select) > Start.

  • SSO in Microsoft Application, SQL Server 2005 & OBIEE 11g

    Dear Gurus,
    Any experienced how to enable SSO(Single Sign On) in OBIEE 11g, when the application platform is microsoft instead of Oracle EBS and the data source from SQL server 2005?
    I am new on this.
    Any help will be appreciated
    Regards
    JOE

    Hi,
    Try below link
    http://sranka.wordpress.com/2008/06/06/enabling-sso-authentication-for-obiee/
    http://gellio.wordpress.com/2009/10/23/enabling-oracle-single-sign-on-osso-with-obiee/
    OBIEE, OAS, OID, SSO Integration
    http://sranka.wordpress.com/2008/06/06/enabling-sso-authentication-for-obiee/
    http://www.addidici.com/blog/?p=8
    http://download.oracle.com/docs/cd/E12096_01/books/AnyDeploy/AnyDeploySSO3.html
    Check the security guide here,
    http://download.oracle.com/docs/cd/E21764_01/bi.1111/e10543/sso.htm#CEGJJFED
    Hope thsi help's
    Thanks
    Satya

  • How to use SQl server 2005's SQLXMLBulkLoad with JAVA

    Hi All,
    I am in a big problem identifying how to use xml bulk insert functionality of sql server 2005 with java.
    I need to enter millions of data into the sql server 2005 database.
    All the material i saw on net includes vb script or asp.net sripts to do so.
    Somebody please tell how I can do this with JAVA.
    Thanks.

    In this forum we commonly discuss connections from Oracle to foreign databases. When you want to connect with your SQL Server to Oracle it would be better to ask that in a Microsoft forum as they support their LINKED SERVER mechanism.
    The linked server set up is for example described in the Microsoft knowledge base as:
    280106 - HOW TO: Set Up and Troubleshoot a Linked Server to Oracle in SQL Server
    In newer SQl Server releases the name changed see for example:
    How to run a SQL Server 2005 Integration Services package as a SQL Server Agent job step
    View products that this article applies to.
    Article ID : 912911
    As you can see they are commonly using OLEDB driver. So you might have to install Oracle's OLEDB driver as well. Else you might think about using OLEDB to ODBC bridge

  • BO XI R2 and SQL server 2005 Analysis services

    Post Author: fasttrack
    CA Forum: Olap
    Hello,
    I am new in BO, I am using XI R2 and I would like to know this:
    I have to build some reports on Data Warehouse using SQL server 2005 Analysis Services.
    My question is:
    1) How I have to build this reports: directly to data warehouse or building an OLAP (CUBE) in analysis services 2005?
    2) BO XI R2 supports SQL server 2005 and especially in this case Analysis services 2005 and provider (I have seen only provider for SQL Server 2000)?
    Do you some good resources where to learn how to make reports on DW SQL server 2005?
    Thank

    Post Author: ShaunOberem
    CA Forum: Olap
    Hello,
    I am new in BO, I am using XI R2 and I would like to know this:
    I have to build some reports on Data Warehouse using SQL server 2005 Analysis Services.
    My question is:
    1) How I have to build this reports: directly to data warehouse or building an OLAP (CUBE) in analysis services 2005?
    2) BO XI R2 supports SQL server 2005 and especially in this case Analysis services 2005 and provider (I have seen only provider for SQL Server 2000)?
    Do you some good resources where to learn how to make reports on DW SQL server 2005?
    Thank
    Hi,
    If you are trying to create a new OLAP Intelligence Report using SQL 05 I am afraid you are out of luck.
    You will need to get a copy of the Productivity Pack (Available for Download in Subscribenet) .
    Also, in your SQL Server Sufrace Configuraiton manager try setting Analysis Services to Allow Ananomous connections. This will make sure you get a little further initially. (Dont leave Anonymous on)

Maybe you are looking for

  • Budget Control at top level WBS only

    Hello All, I have a requirement from client where I need to activate the Budget control (90% warning and 100% error). I have done the setting accordingly. Now the scenario is such that when client is doing budgeting, they are allocating the budget on

  • Change G/L Codes Field Status group

    Hi Experts, I want to change in G/L Codes Field Status group in Mass. Is their any transaction code for that? Please help me. Thanks & Regards, Hemant Maurya

  • Error in Credit memo posting with refernence to customer Invoice

    Dear cheetaz, I am going to post customer credit memo with refernce to invoice. As i enter invoice number in payment tab screen through t code FB75 , system automatically copies terms of payment from invoice i.e. 47 days 2 % cash discount. As terms o

  • Transfer a parameter from one view to another

    Hi, Probably this question was asked many many times before, but then i probably use the wrong search criteria, because i can't find them. My question is simple: I am on a header view and depending on an action which i perform there, i want to fill a

  • Library Module, Gridview - Thumbnail Size

    Assume I'm browsing some folders in the library module, in gridview. I would like to be able to double-click the droplet on the thumbnail slider so that I could see ALL the photos in the folder/collection at the MAXIMUM size. I find it tedious to adj