Generate Scripts Doesn't Take Into Account Dependencies
Aug 31, 2007
I'm having a problem with the generate scripts procedure in Sql Server Express. My database has stored procedures which use views. When I generate the database create script it puts the stored procedures before the views, so that the create script fails when I try to execute it, because the stored procedure can't be compiled until the view is defined. Is there a fix for this or a way around the problem?
I am trying to convert a certificate that was exported from our database server to be used by SQL Server for database encryption. When I run the PVKConverter, not Private Key File (PVK) is generated.The certificate has Server and Client Authentication as the purposes of the certificate.
What purpose or purposes does the certificate need in order to be able to be used by SQL Server 2012 SP2?Why doesn't the PVKConverter generate a private key file?I can use the command makecerts to generate a self signed certificate and have it work with SQL Server database encryption.
I need to write a code for remove dependencies between Table1.Prikey and Table2.Idand add dependencies between Table1.Prikey and Table3.Id how to write the code? please help .. thank you very much
SET @RowCnt = 1 SET @date = CONVERT(CHAR(10),GETDATE(),110) SET @ArchPath = '\D$EDATAWorkFoldersSendSendData' SELECT @TotalRows = count(*) FROM table1 --select @ArchPath
WHILE (@RowCnt <= @TotalRows) BEGIN SELECT @AccountNumber = AccountNumber, @output_filename FROM table1 WHERE Identity_Number = @RowCnt --PRINT @AccountNumber --test SELECT @sql = N'bcp "SELECT h.HeaderText, d.RECORD FROM table2 d INNER JOIN table3 h ON d.HeaderID = h.HeaderID WHERE d.ccountNumber = ''' + @AccountNumber+'''" queryout "'+@ArchPath+ @output_filename + '.txt" -T -c' --PRINT @sql EXEC master..xp_cmdshell @sql SELECT @RowCnt = @RowCnt + 1 END
During install of SQL Server 2005, we can of course use a domain account or the built-in system account for running the services. I lean toward domain for obvious reaons but would like to know a +/- to each option and why I'd choose one over the other and what consequences or limitations one may encounter if I choose one over the other.
I have been running a script in SQL Server 2000 as sa also as a Active Directory user who has administrator rights (I tested both approaches SQL Server then Windows Authentication) in Query Analyser which grants execute rights to the stored procedures within the database instance and Query Analyser does not give any errors when I run the script. I have made sure that each transaction has a go after it. I then return to Enterprise Manager, check the rights (I apply them to roles so that when we create another SQL Server user we just grant him/her rights to the role) and discover that the role has not been granted the rights. I seems to be occurring only with 2 of the procedures. Is there a known bug that might be causing this?
I have several DTS jobs that runs well as a job with my nt login account for the SQL agent service startup account, but if I use the System account they fail with this error. " Error opening datafile: Access is denied. Error source: Microsoft Data Transformation Services Flat File Rowset Provider"
The data has change access to the System account under the NT security.
Basically a dts package has been setup that pulls in data from another companies server, this data requires to be on-demand i.e individual users can pull in updates of the data when they require it.
I am using xp_cmdshell and dtsrun to pull in the data. This obviouly works fine for me as i am a member of sysadmin.
Books online quotes " SQL Server Agent proxy accounts allow SQL Server users who do not belong to the sysadmin fixed server role to execute xp_cmdshell"
So i went to the SQL Server Agent Properties 'Job System' tab and unchecked 'Non-sysadmin job step proxy account' and entered a proxy account.
The proxy account has been setup as a Windows user with local administrator privilages and even a member of the sysadmin server role - just in case.
Now when i log onto the db with my test account - a non-sysadmin - and attempt to run the stored proc to import the data i recieved the message 'EXECUTE permission denied on object 'xp_cmdshell', database 'master', owner 'dbo' '
hmm... so basically i have either misunderstood BoL or there is something not quite right in my setup.
I have search the net for a few days now and yet i can find no solution.
Hi there,BOL notes that in order for replication agents to run properly, theSQLServerAgent must run as a domain account which has privledges to loginto the other machines involved in replication (under "SecurityConsiderations" and elsewhere). This makes sense; however, I waswondering if there were any repercussions to using duplicate localaccounts to establish replication where a domain was not available.Anotherwords, create a local windows account "johndoe" on both machines(with the same password), grant that account access to SQL Server onboth machines, and then have SQL Server Agent run as "johndoe" on bothmachines. I do not feel this is an ideal solution but I havecircumstances under which I may not have a domain available; mypreliminary tests seem to work.Also, are there any similar considerations regarding the MSSQLSERVERservice, or can I always leave that as local system?Dave
I have a situation that I have discovered in our QA database that I need to resolve. When I looked at the Activity Monitor for our server, I discovered that a process is running under a domain user account for one of our .Net applications. The problem is that that domain user account has not been created as a SQL login account on the server. I am trying to figure out how someone can log in to the database server with a domain user account that has not been added to SQL Server as a login account.
Does anyone have any insight on this? I don't like the idea of someone being able to create domain account that can access the database without me granting them specific access.
How can get an object's dependencies in SQL Server. For example it I have written a procedure which accesses some tables inside it then the procedure is said to be dependent on that table. Or one procedure might call another procedure and hence dependent.
Can I know an object's dependent objects from any system table. I think Oracle has a table USER_DEPENDENCIES which provides this info (I may be wrong :-().
The previous post regarding dependencies reminded me of another bugger I comeup with from time to time. SQL Server allows us to rename objects via asystem stored procedure (I usually use an ADP front-end that presumably callsthe same procedure), but after the rename, I find singnificant strangeness.For instance, triggers are still connected to the tables, but the trigger textstill refers to the old table name. Views and stored procedures dependent onthe table are broken, and are not fixed by even by restarting the server,though I thought the cached plans were supposed to be dumped on shut-down,then recreated on demand later.Is there some tool or technique to rename a table and automatically detect andproperly drop/rebuild dependent triggers, views, stored procedures,relationships, and anything else I'm not thinking of?Oh yeah, and there are extended properties to deal with as well, but I guessthat's intractible unless we know what client build them (e.g. Access ADP),and what it expects to be recorded there, but I suppose it would be nice tojust dump them rather than leave them there possibly corrupted from a client'spersective.
I am currently using SQLCacheDependencies to help me manage my cache in an ASP.NET application that is hosted across a web farm. This utilises the SQL Server 2005 service broker feature.
I have implemented this and is currently working but i have a few questions i want to clear up and i hope someone can assist me in that.
1/. I am starting the broker service by using the command System.Data.SqlClient.SqlDependency.Start( <connection string> ); I currently have that piece of code running when the application starts in the global.asax file. What i want to know is will all SQL queries that hit the database register a notification? Is is possible to only have a selected query register a notification?
In my web application only a handful of database queries require a sqlcachedependency to be created. I dont want all queries to be registering a notification as that will place a burden on my backend server.
1/. So does all queries register a notification once the broker is started? 2/. Is there a way to only tell selected queries to register a notification? 3/. When a cache object is invalidated because of a absolute and slidingscaletimeout, does the existing sqlconnection for that service broker get disposed?
I have a table in my SQL2000 server and there's a field in this table being created by an object - with a GREEN PLUS sign (look like an APPEND query in MsAccess). How can I locate and edit/modify that (append query-like) object within my SQL 2000 - Enterpise Manager? Here's some more details:
Table: Customer
Field1: CustomerID
Field2: CustomerRegion_ID (contains the ID above & RegionID below)
When I checked on the dependencies of the table "Customer" I saw 1 dependency and this dependency has 2 table depend on it back-to-back (Customer & Region).
I want to modify the "Field2" of the "Customer" table and I looked everywhere on my VB/stored-procedure codes but couldn't find what triggle the creation of the field. The only thing that I suspect that would be the append object with "GREEN PLUS" sign. Any help would be appreciated.
Is there any way to know as what are all the entities or objects which are dependent upon a given Table? I wanted to know if i update a particular table in a given database on a server, what are all the other tablesobjects which gets effected because of this updation, may be because of some update triggers defined on this tabl or through cascading updates etc. Any system stored procedure which can help me to know these dependencies.
I want to run the SSIS service on a few computers. Can I "only" install this service or does this service needs an instance of the SQL server database as well?
* If it does need the database, can the database be shared between various instances of the service or does each one of them need their own database instance?
* are there any particular databases which are needed by SSIS in order to execute? like master, msdb or tempdb?
Hey! I am creating a kind of file browser for an application of mine. The principle is quite straight forward. It consists of folders and files. Each folder can contain other folders and files and so on. The twitch however is that i need a special root entity called site. The site is very much alike a folder but has some other properties. The site can contain folders and files. To achieve this ive created te following tables (truncated for clearity): #################### Sites ##################### ID [Int] ## ... #################### #################### Folders ##################### ID [Int] ## SiteID [Int] ## FolderID [Int] ## ... #################### #################### Files ##################### ID [Int] ## SiteID [Int] ## FolderID [Int] ## ... #################### Both the folder table and the files table have a check constraint that ensures that either SiteID or FolderID is NULL. They WILL be part of EITHER a folder or a site. Not both! Then i set up the foreign constraints as follows:Folders.FolderD -> Folders.IDFolders.SiteID -> Sites.IDFiles.FolderID -> Folders.IDFiles.SiteID -> Sites.ID All constraints have cascade on delete and therefore the last of them cannot be created as it would be circular. (Wich it wont in this case, but theoreticaly its possible) Iknow WHY this is rendering an error. But how can i work around it? Or would you suggest another design of the tables?
Hi All, How to get all the Dependencies of a Stored Procedure? Dependencies may exists in other databases also. For Example Stored procedure "sp_Employee" exists in the DB "Employee" This SP calling the another SP exists in another DB "Organization" You help would be appreciated.. RegardsGokul
I want to write a query that lists all table names in the order (based on foreign key dependencies to the other tables) that the tables need to be loaded. Using DTS to transfer the data, the tables seem to be loaded in alphabetical order, which causes the load to fail on databases with heavy use of foreign keys. Can anyone offer some help?
As far as I know SQL Server 2005 lists only dependencies within the same database. In many cases though there are objects in one database depending on objects in a different database on the same server. I unsuccessfully looked for a tool to list those and I ended up creating a script to do the job instead. Any improvements are appreciated, e.g. the script uses syscomments which may no longer be available in the next SQL Server version - I have not found a replacement sys.XXX table yet. Please note that you need to use a connection with access to all the SQL databases on a server and that it may take a while to run the script below if you have many databases with numerous objects in there. On the other hand these are exactly the cases when you need to know which of the thousands of objects are dependent on the table or view you are looking at.
P.S. Does anybody know where the extended properties get stored (hint - not in syscomments)? I was looking for those too, since often I document in the description of a field that it links to "DatabaseABC.dbo.TableXYZ.Field1"
Plamen Kouzov
========== declare @searchstring varchar(50) declare @dbid int declare @DBName varchar(1024) declare @command varchar(1024) declare @ServerDBs table([dbid] smallint, DBName varchar(1024)) select @searchstring = 'DatabaseABC.dbo.TableXYZ' insert into @ServerDBs ([dbid], DBName) select [dbid], [name] from master.dbo.sysdatabases where [name] not in ('master','tempdb','model','msdb','pubs','Northwind')
create table #ObjectsFound (DBName varchar(500), ObjectName varchar(500)) while (select count(*) from @ServerDBs)>0 BEGIN set @dbid = (select TOP 1 dbid from @ServerDBs) set @DBName = (select DBName from @ServerDBs where dbid = @dbid) set @command = 'use ' + @DBName + '; insert into #ObjectsFound(DBName, ObjectName) select ''' + @DBName + ''', [name] from sysobjects where id in (select [id] from syscomments where text like ''%' + @searchstring + '%'') order by 1' exec sp_sqlexec @command delete from @ServerDBs where dbid = @dbid END select * from #ObjectsFound order by 1,2 drop table #ObjectsFound
Anybody know if there is a system function that can be used from astored procedure that determines if a given primary key has existingdependencies? I want to make a check for this and if there are none, Iwill delete the record. If there are, I will change a field calledbitStatus from 1 to 0. Enterprise Mgr. does something like this underAll Tasks, Display Dependencies. The normal way I do it is to manuallycheck for the existance of the primary key in every dependent table.SQL 2000 server
Sorry to start a new thread, actually Darren answered my first question on SSIS dependencies but I have a clarification and somehow the software of this forum doesn't allow me to post again on my previous thread. (my posts disappears after some time).
My question is that if I choose to deploy the SSIS packages in SQL Server, then SSIS would have a dependency on SQL Database.
Do we know where the deployed packages are stored in SQL. This information is needed so that I can maintain and monitor the DB where the deployed packages are stored.
Also, do you think its a best practice to deploy the packages in SQL ( I think it will be good because then I can have consistent version of a package deployed on many machines... since I store my packages on one consistent DB rather than multiple file folders on each machine).
I have packages with the execute process task. I have included the exe-file from path A using add->existing item to the SSIS-project so that it lies under miscellaneous files. Deploying these packages using the deployment utility the file gets in the deployment folder that I copy to the server. Running the package installer and installing to SQL Server all files get copied to the B path (dtspackages under sql server by default). Trying to run the package however results in complaints about the file not being at location A. I thus changed the path in the execute process task to a relative one and then I get a complaint that the file "is not in path". So how do I do to make sure it finds the executable at location B where it actually is? I thought the deployment utility would handle this on it's own?
Hi folks ... I am back with another quick question here. I was working on a table and on my absence it was dropped by one of my collegues. I restored it from the backup. The problem is it is not showing all the stored procedures and other tables under show dependencies as the original table was. Is it going to affect the way the stored proc. depenendant on it works..or everything will be fine? If the answer is yes...is there a way I can add the stored procedures or link it to the new table? Thanks for reading and any insight is more than welcome. Tanya
I have a package, which calls a sub package to poulate a table depending on a flag in the database (using an ExecuteSQL task to return flagged table name).
The inner package populates some tables, and calculates what needs to be processed next. It sets the next flag.
However, I can't make this work in the control flow, as once the Execute package has completed, I need to start again from the top, as the flag will have changed to the next item.
I hope that I have explained this well enough.
I really need this to work, but SSIS will not let me create a circular dependency. Does anyone know a way around this, or can offer me an alternative solution??
I am getting desperate, so any suggestions will be welcome
Hello,I have 3 tableTable 1 : list of "whatever" programTable 2: list of tasks for each programTable 3: list of user for each taskWhen I have a new program, I want to select existing task and copy them and assign them to my new program. But I also want to copy the list of user of each task.Is there a way to do that in sql?I do not really want to go through each single task, then copy it with the new program, then get the @@identity of the inserted task and then assign the same user to the newly inserted task.Thanks
I have a table EMPLOYEE in database PERSONNEL, and a table JOBS in database JOBMAN, I want to create a dependencies on the primary key EMP_NUM in table EMPLOYEE and the foreign key EMP_NUM in table JOBS, how can I do it in Enterprise Manager or any other tools?
Hi Foilks , I know it s easy question. I know databases but not SQL dbase. Please explain if you can. what is "DEPENDENCIES" folder in sqlserver table mean please?