Auto Delete Of Data From Database After A Fixed Time Interval? [closed] - sql

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I am using sql server 2005. In my project i wanna auto delete the data from the database after a fixed interval of time say (10 minutes); Is there any automatic process to delete the data from the database without the user intervention.. I want to use the event scheduler i have created a event scheduler but its not working any help ???
this is the event i have created.
CREATE EVENT deletedata
ON SCHEDULE
EVERY 10 MINUTE
DO
DELETE FROM user WHERE id=1

just go through the link Microsoft schedule Jobs
Expand the SQL Server Agent node and right click the Jobs node in SQL Server Agent and select 'New Job'
In the 'New Job' window enter the name of the job and a description on the 'General' tab.
Select 'Steps' on the left hand side of the window and click 'New' at the bottom.
In the 'Steps' window enter a step name and select the database you want the query to run against.
Paste in the T-SQL command you want to run into the Command window and click 'OK'.
Click on the 'Schedule' menu on the left of the New Job window and enter the schedule information (e.g. daily and a time).
Click 'OK' - and that should be it.

Related

Create Agent Job [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
How to Create Agent Job In SQL Server
Follow the steps listed below:
Start SQL Server Agent Service from your ssms
Expand SQL Server Agent
Right Click on Job select New Job
Enter Your Job name and description
Select your database then Write your Procedure or Query in command
Select Scheduler and Schedule your job and set time when you want to run it
You can execute your job manually -right click on your job an dclick on Start Job at Step

Is it possible to execute a SQL dbo automatically? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Sorry if I sound ignorant but I'm new to SQL. I'm using SQL Server 2008. Basically I have a dbo object that displays a list of items, and when I hit "execute" the list refreshes with the most current data.
My question is this: is there a way to set this to execute automatically every minute or so while the table display is open? I plan on sharing out the view of the database so that people can see how far along the DB is before attempting to query it.
Hopefully that makes sense. I tried Google'ing but this seems like a rather vague topic or I'm just too confused to understand what some of these sites are saying. Any help at all would be greatly appreciated.
Clarification:
By "dbo object" I meant a table (I think?). For example it's named dbo.Bridge, and when I right click it I click "edit top 200 rows" to see the data, and then I click the red exclamation mark at the top of SQL Server 2008 to "Execute", which causes the table to update
If you're in SQL Server Management Studio or Visual Studio SQL Server Explorer then you won't be able to do it. You can set delays to execute, however:
WHILE (1 = 1)
BEGIN
SET NOCOUNT ON;
select * from [test_p]
WAITFOR DELAY '00:00:02'
END
This will keep appending onto the existing results, however, that is just a limitation of the software. It isn't meant to do things like this. You're better off just writing a simple script or view to execute every so often and display the data in some other way.
Try using waitfor, something like:
waitfor delay '000:01:00'
select * from MyTable
go 30
This will run the select 30 times, waiting a minute between each run.
(borrowed from Automatically refresh a query in ms sql server management studio?).
Another option would be to drop the query into a connection in an excel spreadsheet (for example), and set the background refresh options (workbook connections --> properties). This is most likely easier than keeping something running all day in sql server.
Edit: If GO does not work for you, check in options to see what word/character is set as your Batch Separator and replace GO with that word.

SQL Database automatic back up [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I have an SQL database - I need to back it up everyday (at a minimum) - preferably multiple times a day - automatically so it definitely gets done.
I'm running Windows which the SQL database is stored on.
What programs (prefer free ones) can I use to back it up - I'm completely new with SQL so if you're gonna explain something - do it in layman's terms thanks (:
It needs to get backed up to another server (on the LAN).
Auto Backup Database Using Maintenance Plans
Simple Step :
Go To SQL Server Configuration Manager > SQL Server Services > Run SQL Server Agent (Set it to Run Automatically)
Go To SQL Server Management Studio, Find TAB Management > Maintenance Plans. Right Click > Maintenance Plans Wizard.
Text your maintenance plans, ex: DailyBackup. Select Option button : Single Schedule for entire task.
Click Configure > Set Schedule according your demands.
Select Maintenance tasks. for this case, you choose Full Database backup.
Click Next, then define which database to backup, set backup location, and backup extension.
Click Next, Choose your report mode, then Finish.
There are many such programs at the moment, you can try EMS SQL Backup. It is not free but it is very handy for this type of tasks and supports backups compression, encryption and upload backups to FTP, network and cloud locations.

How to copy structure of database in another database in sql server 2008? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
i have a database and want to copy all the tables in new database without copying the dat of all those tables only structure should be copy
SQL Server Management Studio offers the following:
Scripting the whole database:
Under the Object Explorer, right mouse click on the database and then select Script Database as
To script just (specific) tables:
In Object Explorer, right mouse click on the database, select Tasks, then Generate Scripts, and then select the tables that you want.
You can then use the script to create a new database / new objects elsewhere. If you change the name of the database, remember to change the USE xxx statement(s) accordingly.
In SSMS for your first database right click on the datbaase name then "Script Database as" > "CREATE To" then choose your output location and run your script.
Edit:
Note you will need to amend the script to specify the new database name, replacing the existing one in the generated script (courtesy of Oded comment).
In the SQL server Management Studio you can right click the database -> tasks -> export data. Then follow the wizard..

Connect SharePoint and Microsoft Outlook [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm a newbie to Microsoft SharePoint Server 2010. Can you please help me with this assignment:
Users wish to enter through the Microsoft Outlook planned absence so
that they will enter them in the calendar, which they will access
directly from Outlook. After entering the predicted absence of the
absence of such a view is their superior, who must approve or reject
the absence. Different employees have different superiors, so pairs
should be "employees" -> "superior" entered into a separate table in
SharePoint, which can be edited by the administrator, workflow validation must
find the appropriate supervisor for confirmation/certification in this table. The
result (absence of confirmed / denied) must be sended an email to the employee,
while the superior must get get e-mail in CC.
It sounds like you have a calendar which is connected to outlook. When user adds new entry in outlook, that entry is added to the SharePoint calendar. In SharePoint you can start a workflow on Item Added on a calendar list. This workflow will do logic to kick of emails , approve/reject.