473,668 Members | 2,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Executing SP_SpaceUsed for tables in a other database with EXEC

Hi

I'm executing SP_SpaceUsed in a stored procedure like this :

Exec ('SP_SpaceUsed '+ @table)

This works great but when i want to execute it for a table in a other
database i'm running in to troubles. Things i tried is this :

Exec ('USE <DB> ; SP_SpaceUsed '+ @table) -->not working (uncorrect
syntax)

Exec ('USE <DB> ; Master.dbo.SP_S paceUsed '+ @table) -->not working
(uncorrect syntax)

Exec ('SP_SpaceUsed <DB>.dbo.'+ @table) --> not working (uncorrect
syntax)

Exec ('Master.dbo.SP _SpaceUsed <DB>.dbo.'+ @table) -->not working
(uncorrect syntax)

Could someone give me a clue
Thanx,

Hennie de Nooijer
Jul 20 '05 #1
1 5860
hd********@hotm ail.com (Hennie de Nooijer) wrote in message news:<19******* *************** ****@posting.go ogle.com>...
Hi

I'm executing SP_SpaceUsed in a stored procedure like this :

Exec ('SP_SpaceUsed '+ @table)

This works great but when i want to execute it for a table in a other
database i'm running in to troubles. Things i tried is this :

Exec ('USE <DB> ; SP_SpaceUsed '+ @table) -->not working (uncorrect
syntax)

Exec ('USE <DB> ; Master.dbo.SP_S paceUsed '+ @table) -->not working
(uncorrect syntax)

Exec ('SP_SpaceUsed <DB>.dbo.'+ @table) --> not working (uncorrect
syntax)

Exec ('Master.dbo.SP _SpaceUsed <DB>.dbo.'+ @table) -->not working
(uncorrect syntax)

Could someone give me a clue
Thanx,

Hennie de Nooijer


exec('exec ' + @database + '..sp_spaceused ' + @table)

Simon
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
28887
by: Brad Tobin | last post by:
On a production database, there is a 2GB database, when I run sp_spaceused it indicates a very high quanity of unused space. The database has been shrunk & free space sent to the OS. Why is this value so high, what can I do to reclaim the space? database_name database_size unallocated space ------------------------------------------------------------------------------ DB_00001 2004.13 MB 49.64 MB
6
21140
by: Robin Tucker | last post by:
I want to look at the size of the current database, so I can create a new one if it gets too big (we are working around the 2gb MSDE limit for our customers). I would like to do something like this: DECLARE @size INTEGER execute BLOB0000.dbo.sp_spaceused
0
476
by: Hennie de Nooijer | last post by:
Hi I'm executing SP_SpaceUsed in a stored procedure like this : Exec ('SP_SpaceUsed '+ @table) This works great but when i want to execute it for a table in a other database i'm running in to troubles. Things i tried is this : Exec ('USE <DB> ; SP_SpaceUsed '+ @table) -->not working (uncorrect
1
1024
by: Saiyou Anh | last post by:
Hi! There's a plenty free space on the drive, while the "unallocated space" column shows negative number when I use sp_spaceused. The database file has been setup as "automatically grow" already. Can anyone tell me what's happening? Is this going to hurt anything? Thanks. Saiyou
4
7067
by: spilich | last post by:
I have a large table that I recently purged a year of data from. However, the table size in sp_spaceused hasn't decreased as much as I would expect. (there are no text or large object columns on this table, BTW) Running sp_spaceused on the table shows the following. rows reserved data index size unused TABLE_NAME 23470880 67790808 KB 18116312 KB 3211616 KB 46462880 KB I ran a dbcc indexdefrag on all indexes on...
7
6197
by: Rick Caborn | last post by:
Does anyone know of a way to execute sql code from a dynamically built text field? Before beginning, let me state that I know this db architecture is built solely for frustration and I hope to make it better soon. Unfortunately, there is never a non-crucial time in which we can do an upgrade, so we are stuck for now. Point 1: There are multiple tables: students, courses, cross-reference
1
4815
by: liorhal | last post by:
is there a command that can change a login role to db_owner in all the tables, or do i have to use { USE table_name EXEC sp_adduser 'login name' EXEC sp_addrolemember 'db_owner', 'login name' } for each of the tables ? thanks
15
7239
by: brettclare | last post by:
I have linked a large SQL Server table to Access, however 'only' 2,195,439 records are shown and are available to query. Can I increase the size (cache??)/number of records showing in Access? Thank you.
2
4661
by: chets | last post by:
Hi All, I am facing problem in executing one dynamic query in PRO *C program on linux. I want to update table mytable by data MADURAI for a column mycolumn1 where primary key is myPK.I want to use EXECUTE IMMEDIATE with context.But it is not working. Following is my piece of code. Please help. Thanks in advance. int main() {
0
8459
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8889
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8790
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8570
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7391
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4202
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.