Is there anyway by which I can decrypt the encrypted Stored Procedures which the Previus DBA had written and its running in Production . I need to make some changes to the Stored Procedure. Is is possible
I created stored function with encryption. after i created i dont able to view the source code from system tables or any tool. i have get back the original source code
note: i want to stored function not for stored procedure.
I would like to be able to store user network passwords in a database table and be able to encrypt and decrypt using stored procs. Could anyone give me a pointer on this.
I want to know the differences between SQL Server 2000 storedprocedures and oracle stored procedures? Do they have differentsyntax? The concept should be the same that the stored proceduresexecute in the database server with better performance?Please advise good references for Oracle stored procedures also.thanks!!
This Might be a really simple thing, however we have just installed SQL server 2005 on a new server, and are having difficulties with the set up of the Store Procedures. Every time we try to modify an existing stored procedure it attempts to save it as an SQL file, unlike in 2000 where it saved it as part of the database itself.
Using SQL 2005, SP2. All of a sudden, whenever I create any stored procedures in the master database, they get created as system stored procedures. Doesn't matter what I name them, and what they do.
For example, even this simple little guy:
CREATE PROCEDURE BOB
AS
PRINT 'BOB'
GO
Gets created as a system stored procedure.
Any ideas what would cause that and/or how to fix it?
How do I search for and print all stored procedure names in a particular database? I can use the following query to search and print out all table names in a database. I just need to figure out how to modify the code below to search for stored procedure names. Can anyone help me out? SELECT TABLE_SCHEMA + '.' + TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'
Seems like I'm stealing all the threads here, : But I need to learn :) I have a StoredProcedure that needs to return values that other StoredProcedures return.Rather than have my DataAccess layer access the DB multiple times, I would like to call One stored Procedure, and have that stored procedure call the others to get the information I need. I think this way would be more efficient than accessing the DB multiple times. One of my SP is:SELECT I.ItemDetailID, I.ItemDetailStatusID, I.ItemDetailTypeID, I.Archived, I.Expired, I.ExpireDate, I.Deleted, S.Name AS 'StatusName', S.ItemDetailStatusID, S.InProgress as 'StatusInProgress', S.Color AS 'StatusColor',T.[Name] AS 'TypeName', T.Prefix, T.Name AS 'ItemDetailTypeName', T.ItemDetailTypeID FROM [Item].ItemDetails I INNER JOIN Item.ItemDetailStatus S ON I.ItemDetailStatusID = S.ItemDetailStatusID INNER JOIN [Item].ItemDetailTypes T ON I.ItemDetailTypeID = T.ItemDetailTypeID However, I already have StoredProcedures that return the exact same data from the ItemDetailStatus table and ItemDetailTypes table.Would it be better to do it above, and have more code to change when a new column/field is added, or more checks, or do something like:(This is not propper SQL) SELECT I.ItemDetailID, I.ItemDetailStatusID, I.ItemDetailTypeID, I.Archived, I.Expired, I.ExpireDate, I.Deleted, EXEC [Item].ItemDetailStatusInfo I.ItemDetailStatusID, EXEC [Item].ItemDetailTypeInfo I.ItemDetailTypeID FROM [Item].ItemDetails IOr something like that... Any thoughts?
I have MSSQL 2005. On earlier versions of MSSQL saving a stored procedure wasn't a confusing action. However, every time I try to save my completed stored procedure (parsed successfully ) I'm prompted to save it as a query on the hard drive.
How do I cause the 'Save' action to add the new stored procedure to my database's list of stored procedures?
We recently upgraded to SQL Server 2005. We had several stored procedures in the master database and, rather than completely rewriting a lot of code, we just recreated these stored procedures in the new master database.
For some reason, some of these stored procedures are getting stored as "System Stored Procedures" rather than just as "Stored Procedures". Queries to sys.Objects and sys.Procedures shows that these procs are being saved with the is_ms_shipped field set to 1, even though they obviously were not shipped with the product.
I can't update the sys.Objects or sys.Procedures views in 2005.
What effect will this flag (is_ms_shipped = 1) have on my stored procedures?
Can I move these out of "System Stored Procedures" and into "Stored Procedures"?
I am writing a set of store procedures (around 30), most of them require the same basic logic to get an ID, I was thinking to add this logic into an stored procedure.
The question is: Would calling an stored procedure from within an stored procedure affect performance? I mean, would it need to create a separate db connection? am I better off copying and pasting the logic into all the store procedures (in terms of performance)?
Hi all - I'm trying to optimized my stored procedures to be a bit easier to maintain, and am sure this is possible, not am very unclear on the syntax to doing this correctly. For example, I have a simple stored procedure that takes a string as a parameter, and returns its resolved index that corresponds to a record in my database. ie exec dbo.DeriveStatusID 'Created' returns an int value as 1 (performed by "SELECT statusID FROM statusList WHERE statusName= 'Created') but I also have a second stored procedure that needs to make reference to this procedure first, in order to resolve an id - ie: exec dbo.AddProduct_Insert 'widget1' which currently performs:SET @statusID = (SELECT statusID FROM statusList WHERE statusName='Created')INSERT INTO Products (productname, statusID) VALUES (''widget1', @statusID) I want to simply the insert to perform (in one sproc): SET @statusID = EXEC deriveStatusID ('Created')INSERT INTO Products (productname, statusID) VALUES (''widget1', @statusID) This works fine if I call this stored procedure in code first, then pass it to the second stored procedure, but NOT if it is reference in the second stored procedure directly (I end up with an empty value for @statusID in this example). My actual "Insert" stored procedures are far more complicated, but I am working towards lightening the business logic in my application ( it shouldn't have to pre-vet the data prior to executing a valid insert). Hopefully this makes some sense - it doesn't seem right to me that this is impossible, and am fairly sure I'm just missing some simple syntax - can anyone assist?
I have been testing two way symmetrical encryption. I have been able to encrypt rows of a spacific column using the following UPDATE statement, however, when I try and decrypt them, the query returns Null for the effected rows. Can anyone see where I may have gone wrong in the decryption statement?UPDATE tblReceipts SET tblReceipts.CCNumber = EncryptByPassPhrase('Abracadabra!1234$',tblReceipts.CCNumber) FROM tblReceipts WHERE tblReceipts.CreditCardType > 0
Decrypt Does Not Work?????
SELECT CONVERT(varchar, DecryptByPassPhrase('Abracadabra!1234$',tblReceipts.CCNumber)) AS CCNumber FROM tblReceipts WHERE tblReceipts.CLIENTID = 15000My CCNumber field is nvarchar(20)My PassPhrase is just a test phraseThe data after it is encrypted in just a bunch of binary looking boxes
How do I tell SQL Server what key to use for DES3 decryption? I want to encrypt in Oracle and after ETL to SQL Server, be able to decrypt but keep a column's value encrypted in Oracle, SSIS and SQL side - only decrypting on the SQL Server side when needing to use the value.
This function is used to initialize the seed for the RC4 algorithmCREATE FUNCTION dbo.fnInitRc4 ( @Pwd VARCHAR(256) ) RETURNS @Box TABLE (i TINYINT, v TINYINT) AS
BEGIN DECLARE@Key TABLE (i TINYINT, v TINYINT)
DECLARE@Index SMALLINT, @PwdLen TINYINT
SELECT@Index = 0, @PwdLen = LEN(@Pwd)
WHILE @Index <= 255 BEGIN INSERT@Key ( i, v ) VALUES( @Index, ASCII(SUBSTRING(@Pwd, @Index % @PwdLen + 1, 1)) )
INSERT@Box ( i, v ) VALUES( @Index, @Index )
SELECT@Index = @Index + 1 END
DECLARE@t TINYINT, @b SMALLINT
SELECT@Index = 0, @b = 0
WHILE @Index <= 255 BEGIN SELECT@b = (@b + b.v + k.v) % 256 FROM@Box AS b INNER JOIN@Key AS k ON k.i = b.i WHEREb.i = @Index
SELECT@t = v FROM@Box WHEREi = @Index
UPDATEb1 SETb1.v = (SELECT b2.v FROM @Box b2 WHERE b2.i = @b) FROM@Box b1 WHEREb1.i = @Index
UPDATE@Box SETv = @t WHEREi = @b
SELECT@Index = @Index + 1 END
RETURN ENDANd this function does the encrypt/decrypt partCREATE FUNCTION dbo.fnEncDecRc4 ( @Pwd VARCHAR(256), @Text VARCHAR(8000) ) RETURNSVARCHAR(8000) AS
BEGIN DECLARE@Box TABLE (i TINYINT, v TINYINT)
INSERT@Box ( i, v ) SELECTi, v FROMdbo.fnInitRc4(@Pwd)
I wanted to configure Report Server and publish my reports. I configured report server 2005 on win 2003 os. I prepared few reports and deployed them. When I tried to view this report thru ReportServer (http://localhost/ReportServer) from my local machine, I got the following error message:- The encrypted value for the "UnattendedExecutionAccountPassword" configuration setting cannot be decrypted.
The report server has encountered a configuration error. See the report server log files for more information. Can anyone help me in solving this! I will highly appreciate it.
Hi, Does any body have a stored procedure or a function I can use? What I need is to encrypt and decrypt a password using Tiny Encryption Algorithm, SO I have an encryption scalar valued function or sproc and similarly decryption function or sproc.Now I need rolling keys to encrypt and decrypt, so I have a table which has keys used for encryption and decryption and depending on the dtae the keys are different.So I alos need a sproc to retrieve the keys.If anybody has done it before or can point me to where can I go let me know?
I'm trying to put together a proof of concept utilizinf encryption with SQL Server and neded to get a little help. I've got the basics down but I'm not seeing the expected results. Here's the script that I'm running against a very simple table. I'm essentially just adding a coulmn to hose encrypted data, encrypting that data, and then selecting that data - in both encrypted and decrypted form:
Code Block CREATE CERTIFICATE LAND_ENCRYPT_ACCOUNT3 WITH SUBJECT = 'ExternalAccountID'; GO CREATE SYMMETRIC KEY AccountID3_01 WITH ALGORITHM = AES_128 ENCRYPTION BY CERTIFICATE LAND_ENCRYPT_ACCOUNT3; GO USE [LAND_ENCRYPT]; GO -- Create a column in which to store the encrypted data. ALTER TABLE Account ADD EncryptedAccountID3 varbinary(128); GO -- Open the symmetric key with which to encrypt the data. OPEN SYMMETRIC KEY AccountID3_01 DECRYPTION BY CERTIFICATE LAND_ENCRYPT_ACCOUNT3; -- Encrypt the value in column NationalIDNumber with symmetric -- key SSN_Key_01. Save the result in column EncryptedNationalIDNumber. UPDATE Account SET EncryptedAccountID3 = EncryptByKey(Key_GUID('AccountID3_01'), ExternalAccountID); GO -- Verify the encryption. -- First, open the symmetric key with which to decrypt the data. OPEN SYMMETRIC KEY AccountID3_01 DECRYPTION BY CERTIFICATE LAND_ENCRYPT_ACCOUNT3; GO -- Now list the original ID, the encrypted ID, and the -- decrypted ciphertext. If the decryption worked, the original -- and the decrypted ID will match. SELECT ExternalAccountID, EncryptedAccountID3 AS 'Encrypted ID Number', CONVERT(nvarchar, DecryptByKey(EncryptedAccountID3)) AS 'Decrypted ID Number' FROM Account; GO
But when I run the "decrypt" the data, the only character that appears unencrypted is the very last character of each account number:
ExternalAccountID Encrypted ID Number Decrypted ID Number
The first value is the unencrypted account id, the second is the encrypted account id, the last is the decrypted account id. As you can see, the decrypted value isn't quite right.
I've tried the AES_256, DES, and AES_128 algorithms and they all yield the same result.
Am I missing something?
Also, if I'm going to be inserting into an encrypted column, do I need to do it via a view and a trigger, or can I just do a straight forward INSERT / UPDATE?
Database Security, we are going to use AES 256 Symmetric Encryption. We will be using RSA for Asymmetric Key Encryption, 1024 Bits.
We got the code working for the seond case but for the first, WHEN:
CREATE SYMMETRIC KEY sym_Key WITH ALGORITHM = AES_256 ENCRYPTION BY ASYMMETRIC KEY asym_Key GO
THEN:
-- Msg 15314, Level 16, State 1, Line 1 -- Either no algorithm has been specified or the bitlength and the algorithm specified for the key are not available in this installation of Windows.
What can be the way out to be able to create the AES 256 Symmetric key.
I am planning to use XP_CRYPT for encrypting and decrypting cc#'s, passwords etc., at database level. Any suggestions or experiences on this. More info about this product at http://www.activecrypt.com/faq.htm
I get a strange error on my SQL Server 2005 database when I try to start replication.
Here is the manipulation leading to my problem: 1. Install new Windows server 2003 and SQL Server 2005 STD, service pack 2. Server is part of a domain. SQL2k5 is running under the LocalSystem account on each machine. 2. Get a copy of yesterday's full backup and transaction logs from running production SQL2k5 server. 3. Restore master, model, msdb and other user databases. 4. Try to start replication using the wizard. I get the following error message
Msg 15466 sp_addlinkedsrvlogin An error occurred during decryption. Msg 15185 no remote user distributor_admin
I suspect this problem has to do with master service keys but need some advice. I am not sure it is related to the master restore since it also occurs on the production machine.
i have created the folowing function but keep geting an error.
Only functions and extended stored procedures can be executed from within a function.
Why am i getting this error!
Create Function myDateAdd (@buildd nvarchar(4), @avdate as nvarchar(25)) Returns nvarchar(25) as Begin declare @ret nvarchar(25) declare @sqlval as nvarchar(3000)
set @sqlval = 'select ''@ret'' = max(realday) from ( select top '+ @buildd +' realday from v_caltable where realday >= '''+ @avdate +''' and prod = 1 )a'