Showing posts with label procedures. Show all posts
Showing posts with label procedures. Show all posts

Friday, March 23, 2012

How to reference items from different database?

Hi all,

I have two databases DB_External and DB_Internal.

I am writing some stored procedures (in DB_Internal) that reads from
the tables in DB_External. I execute my stored procedures from
DB_Internal.

Everytime I want to read the tables in DB_External, I have to refer to
the table as DB_External.dbo.tableName.

Is there a better way of declaring the database DB_External up front
in the stored procedure so I don't have to pre-fix "DB_External.dbo."
in all the table names?

Thanks in advance,
June Moore."June Moore" <jungewum@.yahoo.com.au> wrote in message
news:e5dfaf21.0310100030.3e0067a5@.posting.google.c om...
> Hi all,
> I have two databases DB_External and DB_Internal.
> I am writing some stored procedures (in DB_Internal) that reads from
> the tables in DB_External. I execute my stored procedures from
> DB_Internal.
> Everytime I want to read the tables in DB_External, I have to refer to
> the table as DB_External.dbo.tableName.
> Is there a better way of declaring the database DB_External up front
> in the stored procedure so I don't have to pre-fix "DB_External.dbo."
> in all the table names?
> Thanks in advance,
> June Moore.

You always have to fully qualify the name - there's no way around that. And
it's good practice to include the dbo owner prefix, even in the 'local'
database.

If you're concerned about moving code between servers where the DB names may
be different, you could consider a pre-processor script to 'fill in' or
find/replace the DB names in a code template, then create the procedure.

Simonsql

Monday, March 19, 2012

How to recover Database from .MDF

Hi there,

I lost my .LDF file. Is there a possibility to recover Database from the MDF file with all data and Stored procedures?

Im using SQL Server 2000.

Please help....and sry if this is the wrong Forum for it...

Thx T. Gnewuch

Can you explain what you mean by losing the .ldf file?

Do you have your databases backed up regularly. If so, you can recover your database from the latest backup.

|||Try to use sp_attach_single_file_db, it can recreate the logfile if the database is not corrupt.

HTH, Jens Suessmeyer.

http://www.sqlserver205.de
|||thx , that solved my problem, everything is working fine now again ;)

Friday, March 9, 2012

How to read windows registry thru query ?

Hi
How can I access the windows registry entries from MSSQL Server query analyzer. I am looking for some stored procedures. Are there any system stored procedures ?
ThxExtended procedure xp_regread
USE Master
EXEC xp_regread 'HKEY_LOCAL_MACHINE',
'SOFTWARE\Microsoft\MSSQLServer\Setup',
'SQLPath'

Friday, February 24, 2012

How to query report properties

I would like to get a listing of all my reports and what stored procedures
they use. What would would be the best way to go about this? Is this stored
in the ReportServer database or would I have to query each RDL file?I was not able to find a way to do it, so I'm keeping track manually as I
create sps and reports.
If you find a way, please pass it on!
"DBA72" wrote:
> I would like to get a listing of all my reports and what stored procedures
> they use. What would would be the best way to go about this? Is this stored
> in the ReportServer database or would I have to query each RDL file?

How to Query most recently accessed tables and stored Procedures

Hi!
Anybody Please help me, i want to find out the Query for most recently
used Database tables and stored Procedures i.e from last 6 months. As
bcas of there are lots of Procedures and tables which r unnessary due
to this my site is getting slow.
So if i find the Query so that i can start up cleaning up my database.
Regards
SarithaNo, you would have ran a SQL Server Profiler to gather such info
"subbu" <pakasaritha@.gmail.com> wrote in message
news:1139997806.946690.232430@.g44g2000cwa.googlegroups.com...
> Hi!
> Anybody Please help me, i want to find out the Query for most recently
> used Database tables and stored Procedures i.e from last 6 months. As
> bcas of there are lots of Procedures and tables which r unnessary due
> to this my site is getting slow.
> So if i find the Query so that i can start up cleaning up my database.
> Regards
> Saritha
>|||In addition to URI you can track the executes in the stored procedure
by implementing another logic within the proc which audits and write
the execution calls of itself to a table.
HTH, Jens Suessmeyer.

How to Query most recently accessed tables and stored Procedures

Hi!
Anybody Please help me, i want to find out the Query for most recently
used Database tables and stored Procedures i.e from last 6 months. As
bcas of there are lots of Procedures and tables which r unnessary due
to this my site is getting slow.
So if i find the Query so that i can start up cleaning up my database.
Regards
Saritha
No, you would have ran a SQL Server Profiler to gather such info
"subbu" <pakasaritha@.gmail.com> wrote in message
news:1139997806.946690.232430@.g44g2000cwa.googlegr oups.com...
> Hi!
> Anybody Please help me, i want to find out the Query for most recently
> used Database tables and stored Procedures i.e from last 6 months. As
> bcas of there are lots of Procedures and tables which r unnessary due
> to this my site is getting slow.
> So if i find the Query so that i can start up cleaning up my database.
> Regards
> Saritha
>
|||In addition to URI you can track the executes in the stored procedure
by implementing another logic within the proc which audits and write
the execution calls of itself to a table.
HTH, Jens Suessmeyer.

How to Query most recently accessed tables and stored Procedures

Hi!
Anybody Please help me, i want to find out the Query for most recently
used Database tables and stored Procedures i.e from last 6 months. As
bcas of there are lots of Procedures and tables which r unnessary due
to this my site is getting slow.
So if i find the Query so that i can start up cleaning up my database.
Regards
SarithaNo, you would have ran a SQL Server Profiler to gather such info
"subbu" <pakasaritha@.gmail.com> wrote in message
news:1139997806.946690.232430@.g44g2000cwa.googlegroups.com...
> Hi!
> Anybody Please help me, i want to find out the Query for most recently
> used Database tables and stored Procedures i.e from last 6 months. As
> bcas of there are lots of Procedures and tables which r unnessary due
> to this my site is getting slow.
> So if i find the Query so that i can start up cleaning up my database.
> Regards
> Saritha
>|||In addition to URI you can track the executes in the stored procedure
by implementing another logic within the proc which audits and write
the execution calls of itself to a table.
HTH, Jens Suessmeyer.