January 22, 2010 at 7:30 am
Good Morning,
I am very new to SQL. I am trying to run a SQL on a table to see what changes were made to the system.
Can I use one that's on my system in a folder entitled SQL Scripts? or do I need to create one.
I am using MSSQL Server 2000 and I Query Analyzer and received error message, table already created.
How do I get results of the query?
Thank you for your help.:-)
January 22, 2010 at 8:05 am
To get results from a table, you do this:
Select * from yourtablename
It sounds like you did this:
create table yourtablename (col1 varchar,col2 varchar)
Or something to that effect.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
January 22, 2010 at 8:16 am
Thank you for stating you are using SQL Server 2000 in your initial post. Please, in future, be sure you post your questions in the appropriate forums as this is a SQL Server 2008 forum, and you may get answers that won't work in SQL Server 2000, especially if you DON'T inform people that you are using SQL Server 2000.
January 22, 2010 at 8:31 am
glee777 (1/22/2010)
... I am trying to run a SQL on a table to see what changes were made to the system.Can I use one that's on my system in a folder entitled SQL Scripts? or do I need to create one. ...
I'm not sure what you mean by this.
Are you trying to find changes to the data in a table, or trying to find changes to the structure of a table?
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
January 22, 2010 at 8:32 am
As per the question concerning running a script from a folder or needing to create a new script. That depends - both are viable options.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
January 22, 2010 at 9:00 am
Thank you Lynn. 🙂
January 22, 2010 at 9:05 am
Thank you for your response.
I am trying to find if any changes were made to the table. In this instance a Table was deleted and need to know who deleted it.
There is an SQL Files in a Scripts Folder where looks like a query is written that asks it to create a table, but what I am wanting to do is create a log of any changes on that particular table.
Hope this makes sense.
Again, thank you for your help and patience with helping me to understand.
January 22, 2010 at 9:56 am
glee777 (1/22/2010)
Thank you for your response.I am trying to find if any changes were made to the table. In this instance a Table was deleted and need to know who deleted it.
There is an SQL Files in a Scripts Folder where looks like a query is written that asks it to create a table, but what I am wanting to do is create a log of any changes on that particular table.
Hope this makes sense.
Again, thank you for your help and patience with helping me to understand.
To setup auditing, I would recommend you enable c2 auditing or setup a trace.
To find out who dropped the table - it's too late for the one already dropped.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
January 22, 2010 at 5:52 pm
There's a report you can get on schema changes. Deleting a table is a schema change.
Right-click on the database in Management Studio, and select Reports, then select Schema Changes. It should tell you when the table was deleted and some details about that.
See if that gives you what you need.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
January 22, 2010 at 6:00 pm
GSquared (1/22/2010)
There's a report you can get on schema changes. Deleting a table is a schema change.Right-click on the database in Management Studio, and select Reports, then select Schema Changes. It should tell you when the table was deleted and some details about that.
See if that gives you what you need.
Even for SQL 2000?
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
January 23, 2010 at 9:02 am
CirquedeSQLeil (1/22/2010)
GSquared (1/22/2010)
There's a report you can get on schema changes. Deleting a table is a schema change.Right-click on the database in Management Studio, and select Reports, then select Schema Changes. It should tell you when the table was deleted and some details about that.
See if that gives you what you need.
Even for SQL 2000?
Nope. Saw this was in the SQL 2008 forum and missed that it was about SQL 2000.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
January 23, 2010 at 10:40 am
GSquared (1/23/2010)
CirquedeSQLeil (1/22/2010)
GSquared (1/22/2010)
There's a report you can get on schema changes. Deleting a table is a schema change.Right-click on the database in Management Studio, and select Reports, then select Schema Changes. It should tell you when the table was deleted and some details about that.
See if that gives you what you need.
Even for SQL 2000?
Nope. Saw this was in the SQL 2008 forum and missed that it was about SQL 2000.
It threw a couple of us for more than a minute trying to help
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
January 23, 2010 at 12:47 pm
I've never done it so don't know for sure but rumor has it that C2 auditing is rather fierce in the amount of data it captures. I'm not sure I'd recommend it unless it was imperative to have it.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 13 posts - 1 through 12 (of 12 total)
You must be logged in to reply to this topic. Login to reply