Information Schema In SQL Server 2005
Sep 6, 2007
Information Schema is the part of the SQL-92 standard which exposes the metadata of the database. I have written a small article that exposes the same. Let me know your comments on the same. http://aspalliance.com/1380_Information_Schema_and_SQL_Server_2005
Uday Denduluri
Software Engineer
Refer my articles at http://aspalliance.com/author.aspx?uId=62740
View 5 Replies
ADVERTISEMENT
Sep 5, 2007
I know I've done this before and I can't find, and it's kinda of foggy here today...
anyone see anything with this
EXEC sp_addlinkedserver
'PAERSCBVD0045',
N'SQL Server'
Connect as X002548 since logins are on both serves
*/
-- Tables in 14 not in 45
SELECT S14.TABLE_NAME
FROM INFORMATION_SCHEMA.Tables S14
LEFT JOIN INFORMATION_SCHEMA.PAERSCBVD0045.dbo.MEP.Tables S45
ON S14.TABLE_SCHEMA = S45.TABLE_SCHEMA
AND S14.TABLE_NAME = S45.TABLE_NAME
WHERE S45.TABLE_SCHEMA = IS NULL
AND S45.TABLE_NAME = IS NULL
View 5 Replies
View Related
Aug 14, 2015
I'm looking to dynamically remove records from tables dynamically using the information schema within SQL Server. Looking to remove records from all the tables within a schema. I have gotten as far as generating the script dynamically then using a while exist clause to execute the delete statements.
DECLARE@TargetSchema varchar(100),
--@LibNameData varchar(100),
@fnameIndex varchar(100),
--@startOFR_SCR_FILENAME_DATE varchar(25),
[code]...
Would like to execute the statements generated by the results from the information schema.
View 6 Replies
View Related
Jan 28, 2004
Is there an information schema view that lists all the triggers?
Thanks in advance.
View 6 Replies
View Related
Jan 19, 2004
hi all,
I have a duplicate stored procedure one has proper entries in the information_schema and the other with the same name has null entries in information schema meaning , the specific_schema and routine_schema entries are null and now it doesn't allow me to open the stored proc, neither it allows me to delete the proc.
while deleting it says" procedure_Name not found in the (NULL) collection.
any help will be highly appreciated.
REGARDS,
HARSHAL.
View 1 Replies
View Related
Oct 31, 2005
Hello All,Could someone help provide a query that I can run todetermine the primary key and unique columns for anygiven table ?Thanks in Advance,Akintoye
View 1 Replies
View Related
Sep 10, 2015
Till recently we were using the following code to retreive schema information of columns of tables
Dim schemaTable = connection.GetOleDbSchemaTable( _
System.Data.OleDb.OleDbSchemaGuid.Columns, _
New Object() {Nothing, Nothing, tableName, Nothing})
Now instead of getting the name of table (which i was using as param for filtering) i'm going to receive a sql-query. Now my question is if I were to get a query like the following :
SELECT
[EmployeeID],
[Title] + ' ' + [LastName] + ' ' + [FirstName] AS FullName,
[BirthDate],
[Address],
[City] + ', ' + [Region] + ', ' + [Country] + ' - ' + [PostalCode] AS FullAddress
FROM [dbo].[Employees]
Then how can I retrieve the schema information of only the columns present in the query.
(Its possible that i might get a query with multiple tables with joints)...
View 3 Replies
View Related
Dec 18, 2007
Hi,
I have scheduled a job that runs every minute.
If the job does not succeed, then I would like my front end application to be notified.
I am not sure if this is a reasonable way but I am thinking of somehow
populating a table (Only if the scheduled job fails) in sql server and then read that table every minute from the front end application.
So, is it possible to populate a table if a job fails?
I do not see any options for this in the properties of the job.
Thanks
View 6 Replies
View Related
Jan 17, 2008
How do we determine on a SQL 2005 server what license type was selected during the install? Where is the informationkept and how it is tracked by SQL Server 2005.
Thanks in Advance.
Admindba
View 3 Replies
View Related
Dec 17, 2007
Hi Friends,
I was in the phase of switching over to Sql Server Reporting from the normal reports. I plan to go with the SQL server 2005 standard version. Do i need visual studio 2005 to design and deploy report. If I am using only SQL server standard alone for my reporting and publishing, is it possible to assign the user rights to reports, user can just login and can view all the reports that belongs to that user. Since I wont be using the visual Studio 2005, so I want to implement this using the SQL server 2005. So pls help me with your kind information how to proceed ahead.
Thanks,
Sreekoo.
View 1 Replies
View Related
Aug 10, 2007
Hello, I'm completly new to SQL server 2005 express and wanted to see if somebody can answer a few questions for me.
I recently had a small application developed to import CSV files into a SQL database. The application imports roughly 200,000 records a day and takes roughly 4 hours or longer to import the data. I greatly under estimated the amount of time that it would take to import the data and I'm looking for some solutions to help speed up the process. I'm currently just using my laptop to hold the data. Would it help speed things up by dedicating a seperate machine to hold the data? If so, what type of machine would be best. I'm looking for a cost effective solution because the data is for personal use.
Any information would be appreciated.
Thanks,
View 1 Replies
View Related
Aug 4, 2007
As a normal sql user we are not able to get the disk space information by
executing 'xp_fixeddrive' extended stored procedure.
We are able to get the result using sa user and windows authenticated user.
Any help will be appreciated.
View 3 Replies
View Related
Sep 27, 2006
A database was created in SQL 2000. We are going to move to sql 2005. So I attached a database to SQL 2005 and now I have a problem with name resolution. When I worked with SQL 2000 I did not put my schema's name before table name (select * from table1). The schema's name is my user name (IQA) and by default the schema name is a name of user who loged in. (in 2000)
Here is a problem with SQL 2005. The schema's name is still IQA. But I need to do select * from IQA.table1.
I created IQA login and IQA user is an onwer my IQA schema but I still can not do a select without schema name. I need to resolve this because VB.Net code has all select statement without schema's name. Need help!!!
View 4 Replies
View Related
Nov 9, 2007
I am using sql server 2005 express. When I created a new database my schema name was dbo and my stored procedures looks like this:
dbo.sp_name
Now when I am creating new sp:s my schema name has change to DOMAINUsername:
DOMAINUsername.sp_name
My webb application cant find any sp:s with this schema name and I don't now how to change schema name back to dbo. What has happened, what is this schema name and why has my schema name been changed!? Please help me out!
View 1 Replies
View Related
Nov 26, 2007
Hi Group,(I am just starting with SQL Server 2005.)On SQL Server 7 I used often the nice relation schema, where I used todraw out the whole database, especially the Foreign Keys constraints.I found these relational schemas very handy to study an old database Ibuild a few years earlier that needs some updating.I tried to find such an utility in SQL Server 2005, but cannot find it.I did found the FK-constraints, but it is just an popup where I candefine them.The overview such a visual schema gave was really great and I miss it.Question: Is it gone in SQL Sevrer 2005, or do I just not know where tolook? If the latter, please guide me. :)Thanks for your time.Regards,Erwin Moller
View 1 Replies
View Related
Jul 11, 2006
I wonder how can I track the changes in the columns whether added, deleted or their name is changed and how can I test that?
your help is appreciated
View 9 Replies
View Related
Aug 29, 2005
Hello Everyone,
View 12 Replies
View Related
Aug 7, 2006
Hi everyone,
I'm currently investigating the security improvements of SQL Server 2005. I've got some problems with the schemas introduced in SQL 2005 and security settings.
For my test I've created two schemas: UserManagement and Sales. A user "test" is attached to the UserManagement schema. There's a table Sales.Users containing a list of users (varchar) and a stored procedure named UserManagement.AddUser that can be executed by the UserManagement schema (GRANT EXECUTE, so "test" can execute the SP). UserManagement.AddUser simply inserts a new row into Sales.Users.
Because the Sales schema doesn't contain any user, nobody (except the sysadmin, of course) can do a INSERT/SELECT/DELETE in the Sales.Users table. As expected, the following SQL statement fails:
EXECUTE AS LOGIN='machine est';
INSERT INTO Sales.Users VALUES('Test User');
INSERT was not allowed: object 'Users', database 'test', schema 'Sales'.
The second way of inserting rows into Sales.Users is to execute the stored proc UserManagement.AddUser:
CREATE PROCEDURE [UserManagement].[AddUser]
WITH EXECUTE AS CALLER
AS
INSERT INTO Sales.Users VALUES('Test User');
The user "test" can execute this sproc without problems:
EXECUTE AS LOGIN='machine est';
EXECUTE UserManagement.AddUser;
(1 row(s) affected)To my astonishment the INSERT statement inside the stored proc does execute - although UserManagement.AddUser and Sales.Users are two different schemas. Why is that, is there a chaining happening? To my understanding SQL Server should test INSERT rights on Sales.Users for the UserManagement schema and deny the INSERT statement because UserManagement isn't allowed to INSERT in the Sales schema.
Any ideas? Help regarding the issue is greatly appreciated.
Best regards,
Alex
View 3 Replies
View Related
Apr 22, 2008
Hi,
While i trying to drop the user,i getting the following error:
(Microsoft SQL Server, Error: 15138)"
Now,i wanna change the owner of that schema,Which is associated with the schema,which i am trying to delete.
How to transfer the owner?
Plz help me.
View 1 Replies
View Related
Oct 13, 2006
do the following steps:1:Use Manage Studio login the server with Integrated security.2:Create a dabase named testdb;3:Create a SQL Server login named amber ,and set it to be dbowner oftestdb;4:Create a SQL Server login named guxiaobo ,set it's default databse tobe testbd,and in the testdb databse map login guxiaobo to userguxiaobo;5:Close Manage Studio and reopen it ,this time use login amber log tothe server.6:In database testbd create a databse role role1 owned by dbo;7:In database testdb create a schema schema1 owned by dbo;8:Set user guxiaobo to be member of role1,and set guxiaobo's defaultschema to be schema1;9:In the schema properties-schema1 dialog choose permissions,in theusers or roles listview I add role1 to it.in the explicit permissionsfor role1 listbox,I choose select /update/insert/delete/view definitiongrant checkboxes.and apply the selects.10:In the schema1 schema I create a table:create table a(a int ,bvarchar(10));11:In the dabase role properties-role1 dialog choose securables panel,int securable listview I add the schema1.a table( choose all thecolumns of table a for all permissions),and in explicit permissions forschema1.a I choose all for grant ,then apply the selects.12:Now I use login guxiaobo to log into dabase and issue "select * froma",but got a error msg saying guxiaobo has not enough permission toselect form table a.Does anyone has found anything I missed?
View 6 Replies
View Related
May 23, 2008
Hi all. I'm mapping FKs in a DataWarehouse and I'm wondering if there is a way to change the schema of a database diagram from dbo.
Thanks,
Charlie
View 2 Replies
View Related
Aug 17, 2006
We have a commercial VB.NET winforms client/server application that utilizes SQL Server 2005 express edition. The schema and data that the application utilizes is proprietary and could be very damaging if it got into a competitors hands.
Is there any way to protect the data and schema of a sql server 2005 express edition database?
Will this functionality ever be added?
Thanks
View 1 Replies
View Related
Jun 29, 2007
During web-site development, I am using VStudio 2005 with SQL-Express. I frequently publish changes to my web server that is running SQL- Server 2000 standard edition.
Is there a simple way to replicate changes in database tables design without copying the whole mdf-file and loosing the existing data in the target database?
thanks, Reinhard
View 3 Replies
View Related
Jan 11, 2006
I recently added a new user to my database. Now I want to delete that user, but I keep getting the error above. What do I need to do to delete my recently added user?
View 4 Replies
View Related
Jul 24, 2006
Hi,
Does anyone here know of any on-line references on how to optimize index maintenance in sql 2005? Also do you know of any good DBA books that will explain database maintenance and or best practices?
Thanks.
:D
View 2 Replies
View Related
Mar 12, 2006
Hi All,
I've written a scalar function in C# for the MS SQL Server 2005 that has to have access to two databases in one instance of a server ("database1" and "database2"). I got information from database1, calculate the name of the database2 and got information from user's tables in the database2. But when I'm trying to get informatin from "sys.tables", "sys.columns", "sysobjects" I always get an error "System.Data.SqlClient.SqlException: This statement has attempted to access data whose access is restricted by the assembly."
All databases are inside one server, I can run this quieries in SQL Server management Studio - could anybody help me what should I set/change to get metainformation from another database in the same server (in fact I need a list of fields of a curtain table).
Thanks,
Alex Gerasimov
P.S. Atrribute [SqlFunction(DataAccess = DataAccessKind.Read)] is in the applicaiton.
View 1 Replies
View Related
Apr 16, 2007
Hi all,
I am running a named instance of SQL Server 2005 Enterprise Edition, side by side with named instance of SQL Server 2000 in Windows Server 2003. When I start the installation. I am unable to proceed from authentication stage.
The error description for Database Services and Reporting Services under both sa and windows authentication mode is: Encryption not supported on client Sqlcmd error: Microsoft SQL Native client: Client Unable to establish connection
In Service Manager, all SQL Server 2005 services are running with Logon as Administrator, and I am also able to connect to SSAS, SSRS, SSIS via Management studio both via Windows authentication and sa account information.
Would you please inform if I have to change any security settings before SP2 installation here.
How to add myself a Sql Server Administrator. The link in Surface Area Configuration to Add new Administrator doesn't work.
View 4 Replies
View Related
Aug 31, 2007
I just upgraded from SQL 2000 to 2005 and have been reading up on the new 2005 schemas and how they can be used to simplify assigning permissions, etc. I started experimenting yesterday with a dummy database and ran into a few issues in which I have questions. Note, I am wanting to use Windows authentication as much as possible where end users will be accessing the database via a mapped Windows group. Based on what I've read thus far on the net this presents an issue in that users who access the database via a mapped windows group are not assigned a default schema.
My concern with migrating to using schemas for protecting objects is the potential for breaking existing applications based on the way objects are referenced in code. Most of the existing code simply references the object only ...such as 'mytable' vice 'dbo.mytable'. If I understand SQL 2005 schemas correctly if only the object is referenced in code (i.e. 'mytable') then SQL 2005 looks in the sys schema first then the dbo schema, etc. in attempt to find the object. Basically it defaults to the dbo schema. But issue I forsee is if I used a custom schema ('MySchema') coupled with users accessing the database via a mapped windows group. This is supposedly where a default schema cannot be assigned ...and since db objects won't reside in the 'dbo' schema the SQL won't be able to locate the referenced objects (I.e. 'mytable') and will in turn break applications?
If my assumptions above are correct then it would appear I have limited choices. Use the 'dbo' schema for everything ...or abandon schemas entirely?
View 4 Replies
View Related
Oct 30, 2006
I have SQL Server 2005 Express set up on a PC. I imported a backup of an MSDE database. All of the database objects are there. However, I need to assign permissions to my Stored Procedures. So, using Management Studio Express, I saw absolutely no way of adding a stored procedure to a schema or to a user. So I downloaded SQL Server 2005 Developer from my MSDN account. I installed the client tools to get the full version of Management Studio. Same thing. No way to add permissions to a SP. Some web articles say to right-click the SP and select Properties. However, there is no "Properties" in the right-click menu!!! There is only Rename, Delete, Modify, etc. How can something so easy with an old product be so difficult with a new one? Does anyone know how to accomplish adding permissions to SPs?I can right-click a table or a View and get the popup window with the list view and contents to set permissions to tables and views.
View 7 Replies
View Related
Jan 3, 2008
Hello,
In general, with the introduction of schemas in 2005, is it considered "bad practice" to tell people to create new tables in the "dbo" schema?
Our product documentation contains a "quick start" guide for users who just want to get the product up and runing. We suggest that the customer creates a database for our application. This database is configured with a user that is assigned to the 'db_owner' role (we want to keep things as simple as possible) that we use to connect to the database. This database will only be used by our application. In this situtation is it okay to use the "dbo" schema, or should we consider creating another schmea for all our tables?
Are the any "best practices" for using schemas in SQL 2005?
Thanks,
Brenden.
View 7 Replies
View Related
Jan 28, 2008
i notice there is a nice little report that is maintaining all schema changes, this is becoming rather large.
Is there a way to tidy up the changes on a weekly basic.
Thanks
View 1 Replies
View Related
Sep 1, 2005
Hi all,sorry for the rather trivial question but I couldn't figure this out bymyself.How do you export a db schema either from the commandline or from theGUI (if I remember correctly it's called Management Studio in the newversion).Thanks in advance,Lorenzo
View 2 Replies
View Related
Aug 15, 2007
All,
I have been asked to grant a Windows group Full access to all tables under our Sandbox Schema. This will allow these users to do anything to the tables under this Schema.
I created the Windows Group (Sandbox Users), created the login in SQL, created the user in the database that is tied to the Windows group, then ran GRANT CONTROL ON SCHEMA::[Sandbox] TO [Sandbox Users].
I have verified that the users are in the Windows group, but they state that they still can not delete tables under the Sandbox Schema.
Anyone have any ideas?
Thanks,
Justin
View 5 Replies
View Related