Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8290569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:50:58+00:00 2026-06-08T12:50:58+00:00

I have database A in this database there is a certificate and a table.

  • 0

I have database A in this database there is a certificate and a table. I want to insert an encrypted value into a table which is in database A. The stored procedure is in database B and would ideally make a call like this:

EncryptByCert(Cert_ID('CertifiacteName'), 'SecretData')

This will always fail, because database B cannot find the certificate in database A

Without moving the stored procedure or the certificate, how can I create an encrypted value in database B using a certificate in database A?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T12:50:59+00:00Added an answer on June 8, 2026 at 12:50 pm

    You could wrap the EncryptByCert call in a function that lives in database A like this:

    CREATE FUNCTION dbo.MyEncrypt(@Data VARCHAR(4000))
    RETURNS TABLE
    AS
    RETURN
    SELECT ENCRYPTBYCERT(CERT_ID('MyCert'),@Data) EncryptedData;
    

    To insert data into your table in database A while connected to database B use something like this:

    INSERT INTO DatabaseA.dbo.MyTable(id,EncryptedData)
    VALUES(42, (SELECT EncryptedData FROM DatabaseA.dbo.MyEncrypt('testvalue')) );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database with a table 'Posts Table'. In this table there are
I have this database structure, SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO; CREATE TABLE IF NOT EXISTS `announces` (
i have database table like this +-------+--------------+----------+ | id | ip | date |
Suppose I have a big database, about 800 tables. In this database there is
I have a database table with transactions. In one of the fields there is
Suppose I have this database table (some sample code below) that stores the relationship
I have this database with a table and a row called 'rank'. In that
I have a database with this table: Customer - ID - Phone - Cell
I have a database with regular full-text catalogs. I want to detach this database,
i have in database like this say a table X with columns A and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.