Automatically Add Records In Sql Server 7.0

Sep 13, 2001

I have table A and table B. i want if table A add records, automatically table b add records too.

thanks,
andi

View 1 Replies


ADVERTISEMENT

How To Automatically Create New Records In A Foreign Table When Inserting Records In A Primary Table.

Sep 13, 2006

Ok, I'm really new at this, but I am looking for a way to automatically insert new records into tables.  I have one primary table with a primary key id that is automatically generated on insert and 3 other tables that have foreign keys pointing to the primary key.  Is there a way to automatically create new records in the foreign tables that will have the new id?  Would this be a job for a trigger, stored procedure?  I admit I haven't studied up on those yet--I am learning things as I need them. Thanks. 

View 4 Replies View Related

Automatically Add Missing Records With SQL

Dec 27, 2004

Hi,

I have a table that contains 2 columns. The first column has the datetime, and the second has a value (see the "Before" table). In my SELECT query I want to select all records like 0:00:00 <= Date <= 0:40:00. However the missing 10-minutes value 0:30:00 should be automatically inserted with value = NULL.

Before:

Code:

Date Value
------------------- -------------------
13/12/2004 0:00:00 15
13/12/2004 0:10:00 17
13/12/2004 0:20:00 21
13/12/2004 0:40:00 12
13/12/2004 0:50:00 13



After:

Code:

Date Value
------------------- -------------------
13/12/2004 0:00:00 15
13/12/2004 0:10:00 17
13/12/2004 0:20:00 21
13/12/2004 0:30:00 NULL
13/12/2004 0:40:00 12



Can anyone help me? Thanks.

View 6 Replies View Related

Automatically Adding Records To Child Table When Record Added To Parent Table

Aug 19, 2006

In SQL Server 2000, I have a parent table with a cascade update to a child table. I want to add a record to the child table whenever I add a table to the parent table. Thanks

View 1 Replies View Related

SQL Server 2008 :: Load Latest CSV Files From File Server Automatically

Feb 4, 2015

I need to load the latest csv files from file server , The files are placed in a folder called -

Posted 02022015- --> csv files .

I am able to copy the csv files from filserver using bulk insert (manually) , giving the file location

I am having difficulty picking up the latest folder which is posted on the server and import it into database using a stored proc .

View 2 Replies View Related

How Can SQL Server DTC Be Stopped From Automatically Enlisting A Remote Server In A Distributed Transaction?

Mar 9, 2007

How do I stop a remote query that INSERTS into a local table from being automatically "upgraded" to a distributed transaction?

I am using Windows 2000 server and SQL Server 2000 SP3a on both machines.

I am executing the following statement in Query analyzer.

INSERT MyLocalServer (col1)
EXECUTE MyRemoteServer.Master.dbo.sp_executesql
@RemoteQuery,
@ParameterDefinition,
@Paramter = 'somevalue'

@RemoteQuery consists of a SELECT four-table join, all tables are on the same linked server.

The Linked server has been set up on MyLocalServer using the "Microsoft OLE DB for SQL Server" provider. In the "Provider Options" for the linked server properties I checked "Non transacted updates" and "dynamic parameters". In the "Server Options" tab I have checked "RPC", "RPC Out", "Data Access".

The EXECUTE part of the query runs great (and returns the data very fast) by itself. But with the INSERT part, the query fails and returns the error:

"Server: Msg 7391, Level 16, State 1, Line 17
The operation could not be performed because the OLE DB provider 'SQLOLEDB' was unable to begin a distributed transaction.
[OLE/DB provider returned message: New transaction cannot enlist in the specified transaction coordinator. ]
OLE DB error trace [OLE/DB Provider 'SQLOLEDB' ITransactionJoin::JoinTransaction returned 0x8004d00a]."

The two servers are seperated by firewalls, so I believe the reason the query is failing is that I haven't followed the procedures for setting up the ports etc described in one of the microsoft support articles: e.g.: 250367.

Configuring the ports involves too much company politics, and besides, for what this query does, it does not need the benefits of a distributed transaction.

How can I execute my query without SQL Server automatically trying to upgrade it to a distributed transaction?

More Info: I can execute the query as a straight INSERT/SELECT linked-server query and it does the INSERT on the local SQL Server just like I want it to, so I assume it is not trying to use distributed transactions; but it takes around 7 seconds to run even though the entire SELECT is executed on the linked server, whereas executing with sp_executesql takes only 1 second.


I thought selected "non-transacted updates" in the provider would solve this problem, but it did not.

Anyone know the answer?


View 2 Replies View Related

Get Server Name Automatically In DTS ActiveX

Nov 2, 2000

I'm looking for a way to get the name of the server on which the DTS package lives.

I copy packages between servers. The problem is that everytime a package is copied
to different server, I have to change the reference in the connection strings to point
to the new server name. I'd like to find an automatic way to interrogate the server
name where the package currently lives and dynamically change connection strings
from within an ActiveX task. That would cut maintenance way down.

View 1 Replies View Related

SQL Server Will Not Start Automatically

May 7, 2002

I installed SQL Sp2 and at the same time took Carbon Copy off. No when the machine comes up neither SQL Server or the Agent will not come up. If I go to Service manager I can start both just fine. Nothing in either log to show why. Anyplace or any thoughts

View 2 Replies View Related

Sql Server Restart Automatically

Feb 18, 2004

Hi,

I have SQL server running on windows Adv Server 2000. Since last couple days whole computer restart every one hours. Only thing I remember doing was to shrink database db size is 200+GB.

How can I fix this problem.

Any help will be highly appreciated?

Thanks.

Samir

View 1 Replies View Related

Automatically Reset SQL Server

Mar 4, 2008

Hi all,
I am wondering if there is a way that the SQL server resets every few hours. I am using an application which is heavily utilising SQL server and the server crashes every now and then. I can reset it manually but I was wondering if there is a way that it detects the crash and reset itself automatically. Thanks a million in advance.

View 2 Replies View Related

SQL Server Service Always Starts Automatically

May 2, 2008



I have a laptop with vista and sql 2005. When i start my computer, after it boots up and is ready to go, I look in the task manager at the process tab. Some sort of SQL Server component is running and eating up about 50k's worth of memory. What is it and how do set either Vista or SQL Server to not start whatever this is unless I do it manually(oh yeah...how would I turn it on?)and what are the ramifications of not having it start up when i start my laptop?

I know it is a rather rambling question, but its the best I can describe it. Thanks in advance for your help!

View 4 Replies View Related

SQL Server Memory Not Cleared Automatically

Mar 3, 2008



I have installed sql server 2005 in cluster. after all the process is finished the memory usage is showing 2 gb where as in the activity monitor there is no process running. what should i do to clear the memory automatically.

If i stop and start the serverice it is cleared, nor do i want to run any command to clear the memory.

View 1 Replies View Related

SQL Server Agent Stoping Automatically...

Mar 26, 2008



Hi all

I have a mainteenance Server,SQL Server 2000 Installed on that server,every day some time in mid-night Agent it self stoping

What may be the reason...where I have to find out reason for stop.


Any advice and Help is appreciated.


View 11 Replies View Related

SQL Server 2008 :: Parent Records Ordering And Display Child Records Next To It?

Sep 7, 2015

declare @table table (
ParentID INT,
ChildID INT,
Value float
)
INSERT INTO @table
SELECT 1,1,1.2

[code]....

This case ParentID - Child 1 ,1 & 2,2 and 3,3 records are called as parent where as null , 1 is child whoose parent is 1 similarly null,2 records are child whoose parent is 2 , .....

Now my requirement is to display parent records with value ascending and display next child records to the corresponding parent and parent records are sorted ascending

--Final output should be

PatentID ChildID VALUE
33 1.12
null3 56.7
null3 43.6
11 1.2
null1 4.8
null1 4.6
22 1.8
null1 1.4

View 2 Replies View Related

I Want To Transfer ONLY New Records AND Update Any Modified Records From Oracle Into SQL Server Using DTS

Jul 23, 2005

I need a little help here..I want to transfer ONLY new records AND update any modified recordsfrom Oracle into SQL Server using DTS. How should I go about it?a) how do I use global variable to get max date.Where and what DTS task should I use to complete the job? Data DrivenQuery? Transform data task? How ? can u give me samples. Perhaps youcan email me the Demo Package as well.b) so far, what I did was,- I have datemodified field in my Oracle table so that I can comparewith datelastrun of my DTS package to get new records- records in Oracle having datemodified >Max(datelastrun), and transferto SQL Server table.Now, I am stuck as to where should I proceed - how can I transfer theserecords?Hope u can give me some lights. Thank you in advance.

View 2 Replies View Related

How Can I Detect Changes Automatically In The SQL Server Database When Anything Is Updated..?

Mar 13, 2007

I been asked recently in the interview thatHow can I detect changes automatically in the SQL Server Database when anything is updated, deleted or inserted?if anyone can help me in this that will be really great.
I dont actually know whether I can ask this here but I wanted to know the answer for this and thought this might be right place to ask?
sorry if I am wrong?
Thanks in Advance

View 2 Replies View Related

How To Change Text On Web Automatically From Reading A SQL Server?

Jun 17, 2004

A section of this company's intranet site where I just started interning at has little company anniversary and birthday sections that look like (for the anniversary section.. in the birthday section, it looks the same, except it doesn't say how old the comployee is):

-Steve Cunningham 6/1 - 6 yrs
-Andrew Brown 6/3 - 11yrs
-Lisa Stone 6/4 - 3 yrs

How can I get it so instead of manually changing that text every month, it will look at a SQL database and automatically change that text every month? I'm guessing the pseudocode would be if the b-day or anniv. month matches the current month, display the first and last name, the date, and number of years (which would have to be calculated maybe?) Any help would be GREAT! Thanks!!

~Michael

View 2 Replies View Related

SQL 2012 :: Automatically Syncing Database To Different Server?

Jul 25, 2014

We have two SQL 2012 servers, sever A and B.

We need to sync a database on A so that there is a copy of it on B.

We need to be able to query both databases so mirroring isn't an option.

View 7 Replies View Related

MS SQL Server 2000: Rows Get Sorted Automatically

Feb 6, 2008

Hi all,

I import MS Excel 2003 spread sheet in MS SQL Server 2000 through MS SQL Server 2000 Enterprise Manager (rightclick on the table to be filled with dataall taskimport data). My excel file have 2000 rows and 100 columns of data. All the data are imported in relevant attributes cells in good manner. But the rows are sorted automatically. I am trying to say that first row data is match with my excel file. But second row data have gone to 7th row and 7th row have gone to 5th row like that. I need the data sequence what I have in my excel file. What is the problem occurred? How can I solve this?
Can I export my MS Excel 2003 file to MS SQL Server database?
Please help me. I don't have more knowledge in MS SQL Server 2000.
If your answer has any query to run then please mention where should I run that query.
Thanks,

With Regards,
bala.

View 3 Replies View Related

How To Install Sql Server 2005 Automatically With Sa Password

May 25, 2007



Hi!



How to install sql server 2005 automatically with sa password



I want to know that i am creating a setup in visual studio 2005, i have set up sql server as prerequsite, by default the sql server installation is silent, it does not ask anything, in MSDE we had the facility of setyp.ini file which automatically creates the database with the settings provided in the ini file. Is there any option like this in sql server 2005 express editon.





[Options]
INSTANCENAME="MSDE"
SECURITYMODE=SQL
SAPWD="admin"






now what can be done in sql server 2005 express edtion

View 1 Replies View Related

DB Engine :: How To Automatically Send Mail From Server

Jul 17, 2015

I have developing sample application for automatically send failure mail to respective person. Also i have storing all the failure mail details to database for unavailability of mail server. Once if the mail server available that time we will send all the failure mail to respective person.

View 5 Replies View Related

Standby Server - Applying Transaction Logs Automatically

Jun 21, 2001

Can anyone direct me to a code that would automatically apply transaction logs to a DB in the standby server? We have a process that dumps the transaction log backup from the primary server into the backup server every hour on the hour, but I need to apply that transaction log as soon as it is in the standby server.

I am sure someone will ask, why not do transactional replication or log shipping? My answer to that is I have yet to learn how to setup replication between servers. I need to get our backup server up and running in the next few days.

Thanks in advance for your help.

Helen

View 1 Replies View Related

SQL Server Enterprise Manager Closing Automatically From Console

Oct 5, 2006

This is the weirdest this I have ever seen in a long time. I have MS SQL Server running on a server and use Enterprise Manager a lot. Well, the damndest thing happens when I log onto the server from the console and run Enterprise Manager. If I go into Enterprise Manager, and go to a database and then select a table and right-click, and run the "Open Table" option; the entire Enterprise Manager application mysterously closes.

This only happens from the server console and through Remotely Anywhere...it does not happen when I log onto the server from Remote Desktop.

Has anyone ever seen this before? Does anyone know a fix for this?

View 1 Replies View Related

SQL Server Automatically Changing Date 1900-01-01 To 2001-01-01

May 16, 2008

I have a SSIS data flow task that downloads data from an Oracle source which has some real dates and some date values of 0001-01-01 which I am trying to convert to '1900-01-01' using a decode(Date1,'0001-01-01','1900-01-01',Date1). The problem I am having is that when I run the package in Business Intelligence Development Studio on my local machine the date value is stored correctly in the SQL table in a datetime field as 1/1/1900 12:00:00 AM, however when I run the package from the server the field gets saved as 1/1/2001 12:00:00 AM.

I have tried a bunch of ways to work around this issue and the only solution I have found that works it to download into a temp table and then load into the live table. Does anyone have any idea of what might be causing this issue when I run the package from the server?

View 1 Replies View Related

DB Design :: Prevent Server From Automatically Adding Brackets

Aug 17, 2015

I have a problem setting the default value of a column. I am trying to set it to

(CONVERT([float],getdate()+(2),0))

However, SQL Server automatically sets it to

(CONVERT([float],getdate()+(2),(0)))

While it functionally does not change anything, we have a tool which compares the database schema against a pre-existing schema and shows this as an error.I have tried setting the value directly and through scripts but it does not work either way.

View 2 Replies View Related

Are Calls To SQL Server EndPoints Automatically Enlisted In A Transaction?

Mar 8, 2008

All -

I have a SQL Server 2005 HTTP endpoint. I create a transaction scope in a client application and call two methods on that endpoint. Will the operations performed in the two methods, really, be in a transaction?

In other words, will SQL Server enlist in the ambient transaction even when I am accessing it through a HTTP endpoint?

Thanks.

View 4 Replies View Related

Should The SQL Server Express Service Start Automatically Or Manually?

May 13, 2008

Hello all,

We are deploying an application using SQL Server Express to a wide variety of desktop and laptop machines. We are currently trying to decide whether we should install the SQL Server instance service to start automatically at startup or not. In the latter case, our application would start and stop the service.

Starting automatically will make our app load more quickly, which is important to our users. However, our support team is concerned that leaving the service running will leave our databases vulnerable to becoming "suspect" if, for example, a laptop user's battery dies suddenly. Of course this will always be a problem if the app is running, but our support team believes that having the service running all the time will increase the chances of this happening. One reason for their concern is that an older version of the software used MSDE which was running all the time, and they saw a good number of suspect database issues.

What is the best practice for leaving the service running, especially when there are a lot of laptop users?


Thanks,
Ben

View 3 Replies View Related

SQL Server 2012 :: Automatically Adding New Databases To Availability Group

Oct 28, 2013

automatically replicates new databases to Availability Group partners - if you do a little prep work on your environment first.To make it work:

1) Create linked servers on all group members pointing to all other servers in the group, with names matching the hostnames they represent.
2) Ensure suitable credentials (or 'current context' impersonation) for linked servers. Also: Enable RPC and RPC OUT
3) Run the DDL code below.
4) Schedule hadr_replicate_queue on [master] to run as often as you want initial syncs to occur. Every 5-10 minutes is plenty for most purposes.
5) Connect to an availability group listener and call CREATE DATABASE :)

I use a slightly more extended version of this code at home to do things like permissions synchronization across replicas - I essentially allow applications to install direct to an availability group replica and then have all the relevant objects replicate to other nodes. I don't really like going through manually and doing things, even though there's an AddIn from SQLSkills for management studio - it still requires manual intervention.

The main use I have for this at home is that I'm using the Azure pack, and want to automatically ensure that my newly created 'SQL Server Cloud' databases are highly available, plus it means when I install a non-alwayson aware product it doesn't require any extra work afterwards to allow failover to another machine.

* AlwaysOn Self-Population Script
* By: Steve Gray / steve@mostlyharmful.net
* Usage: Free, but buy me a beer if you're ever in Brisbane.
**/
USE [master]
GO
IF EXISTS (SELECT * FROM sys.tables WHERE name='hadr_pending_replicate')

[code]....

View 4 Replies View Related

SQL Server 2012 :: Increment Date Based On Time Value Automatically

Jul 1, 2015

I have a client data which has the candidate id, a start date which will have only the date in varchar format and a time value associated to that date in varchar format in a seperate column.

To give a brief explanation about the data a candidate will come to study center at any time point in a day for example 10:00 AM on 20-10-2014. The start date will be 20-10-2014 and from 10:00 AM he will have test based on the time point. So if the time point is 2 HR, then at 12:00 PM he will have a test. If the time point is 8 HR, it will get added with 10:00 AM and based on this he will have the test at 06:00 PM. When the timepoint reaches 00:00 the start date needs to be the next date instead of 20-10-2014.

The start date needs to be appended with the time value such that when it crosses over the time 00:00, the start date needs to get increased by 1 ie the next day. I have added the start date to the time by using the code below

CAST(STARTDATE as datetime) + CAST(CAST(STUFF([TIME],3,0,':') as time(0)) as datetime) as [EXPECTEDDATETIME]

By this above code i have created the expected datetime however

I will not be able to hardcode the value due to dynamic data. I tried to apply >= and < to the time value something like

case when MyTime >= '00:00' and MyTime < '08:10' the Dateadd(day, 1, date)

This works perfect but my concern is that I cannot put the value 08:10 because it will not a constant value for all rows.

I have provided a screenshot of my data and a expected date column for reference.

Candidate StartDateStartTimeExpected DateTime Timepoint
1 20141020 1000 2014-10-20 10:00:00 0 HR
1 201410201200 2014-10-20 12:00:00 02 HR
1 201410201400 2014-10-20 14:00:00 04 HR
1 201410201800 2014-10-20 18:00:00 08 HR
1 201410200000 2014-10-21 00:00:00 12 HR
1 201410201200 2014-10-21 12:00:00 24 HR
2 20141020 1100 2014-10-20 11:00:00 0 HR

[Code] ....

I have also attached the data for reference.

View 9 Replies View Related

SQL Server 2008 :: Automatically Execute Script Once Database Has Been Attached

Jul 29, 2015

our clients have the flexibility to detach and attach databases (I know there are a lot of considerations around this but there is now way of changing it), once they attach a database we need to run some code to update a bunch of values in the database.

Other than creating a SQL Agent job are there any other options available to automatically execute a script once the database has been attached?

View 1 Replies View Related

How To Backup A Database In Sql Server Management Studi Express Automatically

Mar 3, 2008

I come cross some post about how to backup a database in Sql Server Management Studio Express automatically. The scripts look like as below

USE [master]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_BackupDatabase]
@databaseName sysname
AS
BEGIN
SET NOCOUNT ON;
DECLARE @sqlCommand NVARCHAR(1000)
DECLARE @dateTime NVARCHAR(20)
SELECT @dateTime = REPLACE(CONVERT(VARCHAR, GETDATE(),111),'/','') +
REPLACE(CONVERT(VARCHAR, GETDATE(),108),':','')
SET @sqlCommand = 'BACKUP DATABASE ' + @databaseName +
' TO DISK = ''C:Backup' + @databaseName + '_Full_' + @dateTime + '.BAK'''

EXECUTE sp_executesql @sqlCommand
END



It throws that the DDL statement is not allowed. What's wrong with it?

View 5 Replies View Related

SQL Security :: Log Shipped Database Server User SID Is Created Automatically

Jun 11, 2015

We have a production server "prod"  which has a user say 'test' that lets the users connect to the application and  a logon trigger which stops them from connecting to the server through SSMS. I  log ship 'prod' to the 'rep' database and the user 'test' is obviously created in the logshipped database 'rep' during the logshipping.

Now the login 'test' does not have any login from server 'rep', But people can still login to the 'rep' server and query the 'rep' db . I checked with SUSER_SNAME and found the SID of the user in rep server which I never created and which is not even present in the login names, Even If I create a new username in the 'prod' db, after logshipping the new user is replicated in the 'rep' server.

View 9 Replies View Related

SQL Server 2008 :: Can SSRS Report Be Automatically Saved As Excel File

Feb 13, 2015

I have a report that is scheduled to run a once a week. This works fine. But now I would like this report to be saved as an Excel file automatically when it runs. how / where do I do this?

View 0 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved