View the query by which a table was created in SQL Server 2000 [duplicate] - sql-server-2000

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How to see query history in SQL Server Management Studio
I have created a table by create command in sql server, I executed the query from query analyzer and then I closed the query analyzer. Now I want to see that query by which I created the table how can I do it?

Right-click on the Table in your Object Explorer and select Script Table as... -> CREATE to -> New Query Editor Window.

In general - NO. But you can get just similar script by various scripting modules, including supplied with Sql Server 2000 (Enterprise Manager and Query Analyzer Script Table as context menu)
OR
exec sp_help 'tablename'
May provide you sufficient information for your needs

Related

Fetching the data from two different servers in SQL Server [duplicate]

This question already has answers here:
Querying data by joining two tables in two database on different servers
(11 answers)
Closed 4 years ago.
How can I fetch the data from two different databases that are on different servers in SQL Server?
You will need to create a linked server to the server where you will execute the Query.
You can use sp_addlinkedserver to create one. You may reference here.
Sample would be for the same SQL Server
EXEC sp_addlinkedserver
N'SEATTLESales',
N'SQL Server';
GO
Once you have created the linked server. You can now reference it in your query by doing something like this:
SELECT * FROM [NameOfLinkedServer].[DatabaseInLinkedServer].[dbo].[TableInLinkedServer]
Or you can check Dave Brown's comment to your question: Here.
You can indeed do this, but I recommend against it. You can create a linked server on DB-SERVER-1, connecting it to DB-SERVER-2.
(A linked server definition is setup by the DBA. It contains the login credentials to the remote server. If you want to provide the login credentials yourself each time, that would be an openquery or openrowset command.)
You then could write a query using four part naming convention as follows, assuming you are running this query on DB-SERVER-1:
select *
from DB1.dbo.YourTable a
join [DB-SERVER-2].DB2.dbo.OtherTable b on b.ID = a.ID
Cross server joins are notorious for having performance problems. I would only do it for administrative purposes, and definitely not against large result sets.

See all the SQL statements executed in Oracle DB 12c [duplicate]

This question already has answers here:
How can I see queries that are executed against Oracle?
(3 answers)
Closed 5 years ago.
I'm an administrator of DB with DBA role. So I need to gather all the SQL statements executed in DB in all sessions. Does anyone know if there is a command that shows a list of username and SQL statement executed by him? Thanks in advance.
The closest thing you can get to that is by querying DBA_HIST_ACTIVE_SESS_HISTORY.
If sessions did not matter to your requirements, you could query DBA_HIST_SQLSTAT.
both required diagnostic pack license

Function usage in SQL Server 2008 R2 [duplicate]

This question already has answers here:
How to find all the dependencies of a table in sql server
(13 answers)
Closed 6 years ago.
I can find one scalar valued function in one database.
I just want to know where that function is being used like in any stored procedure or any view.
Is there any query to check this?
Thanks in advance.
You could download SQL Search by RedGate if you're allowed to install things.
Alternatively you could script out the database, Right Click on your database -> Tasks -> Generate Scripts. This will script out the entire database (any objects you select) and will take a while on a larger system. Once it's finished you'll be able to use Ctrl+F to search and see where the function is called.

how can i see all the scheme in the sql server 2000 [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How do I obtain a list of all schemas in a Sql Server database
I manage to see all the schemas in the sql server 2000. I used the following statement
show search_path
But it failed.
Please try:
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA
For more info please refer link How do I obtain a list of all schemas in a Sql Server database

Get a print out of INSERTs from a table in SQL Server [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
SQL Server 2005 - Export table programatically (run a .sql file to rebuild it)
Generate INSERT statements from a SQL Server Table
I have a table in SQL Server 2005 and want to get a printout out of inserts so I can copy and paste them into my production server (I cannot directly link to production server).
I just want a print out of X number of records from a very large table.
select * from data where tableID > 10100;
The above is the condition I want to use to figure out which records to generate the inserts for.
Try one of the many third-party tools around that do this:
SQL Server 2008 R2 - generating INSERT statements for a table (I believe this also works / is also available for the 2005 version)
See this other SO question on the same topic (and the answers!)
SQL Server 2005 Script to Generate INSERT statements
Generate Insert Statements For a SQL Server Table
or just plain Google (or Bing) for it! There's tons of material out there....