To track the changes in a view on daily basis [closed] - sql-server-2005

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 8 years ago.
Improve this question
How could I get the changes (data) in a view between a certain period of time. Changes like new rows, updated rows or deleted rows. I am making a stored proc which has to detect the changes in a huge view and then sync them with another table on daily basis. I dont want to to scan all rows when I know the changed rows will be less than 1% daily.
Thanks.

The view is going to change when the underlying data changes. You need to detect changes in the columns in the tables that are in the view - you will probably need triggers on that column that will fire a stored procedure that reconstructs the SELECT query the view is using, and then update the other table as necessary.

Related

Apply Database Changes after edit SQL Server [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 8 years ago.
Improve this question
I have a DataBase SQL , I did some changes in tables and datatype of this data base
but this data base contains data
I used a select Insert statement from the old database to the new one after edit
Is it the best way to bring he data to the new database or I can use better way ??
It depends why you are doing it and when.
If you are doing this as a one off process on your development machine and there is only a small number of simple tables then this approach will be fine
If you are doing it for a larger number of tables, need it to be re-runnable or want a GUI then use SSIS or "SQL Server Import and Export Wizard". It's easy to use.

SQL Server : create jobs [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 8 years ago.
Improve this question
I need to create a procedure which repeats itself several times. Let's say I want to change a character's position in a browser game for 3 minutes from one place to another. Its coordinates change constantly in the database. I need it to be dynamic so that I can use this code to move the character to more places in a different amount of time depending on the parameters passed to the procedure.
How can I do it?
Does jobs solve the problem? If so, how can I do it with jobs?
You could use the RAND() function to generate random coordinates, and a sql agent job to run the procedure throughout the day.
Since you mentioned that the coordinates change constantly in the database, you can have an update trigger that runs the stored procedure you have in mind instead of relying on a job. Let me know if you need more info on this.

Want to do some changes in the existing table that is created two days back [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 8 years ago.
Improve this question
I had created one table called PLANCESS two days back. Now i want to do some changes in the table using TOAD. How can i get back? What query should i use? FYI I am a beginner. Could you please?
Look up the alter table statements in the documentation of Oracle (for example here)
For the sake of it, you wouldn't refer to these types of statements as queries but as ddls (Data definition language).
You can use alter query to make changes in your "PLANCESS" Table.
one another way is you just open the property box of your "PLANCESS" Table and you can edit from there also.
But property is only change in TOAD.
Write table name and press F4 you will get property window of that table.
Regards,
Chaitanya

Store a temporary table and update it every hour [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 8 years ago.
Improve this question
I have never done this before, and I'm not sure if it is possible. Basically, I have a big query that takes around 1-2 minutes to run. What I'd like to do is:
automatically execute and put result into a table every hour.
My webpage will then query against the temporary table instead, which should be quicker.
I am looking for the steps to do this like. First, create a stored procedure. Second, setup somewhere to run the store procedure automatically. I'm not sure how to proceed — can you suggest how?
SQL server supports running scheduled jobs. You can look here.
http://technet.microsoft.com/en-us/library/ms190268%28v=sql.100%29.aspx
Also check this question, it should give you
a very good idea of the steps you need to take.
How to run a stored procedure in sql server every hour?

Need a query to get a list of used and unused tables [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 9 years ago.
Improve this question
I gave a list of tables from our schema in a text file to my boss asking him that we need NOT back up all these tables. Now he is asking me to write a query to return the rest of the tables which REQUIRE BACK UP.
He gave me the hint that I will have to use USER_TABS and DIFF in my query.
Can anybody please help?
I am using ORACLE database.
What criteria defines a table that is "unused" and what criteria defines a table that "needs backup"? And what do you mean by "backup"?
If you're talking about backups, you'd normally be talking about physical backups in which case you back up the entire database (either a full backup or an incremental backup depending on how you've structured your backup strategy). You would not and could not include or exclude tables from a physical backup. You could potentially move the tables to a read-only tablespace which lets Oracle know that they don't need to be backed up again. But it doesn't sound like that's what you're after.