Sql Server 2008 >> msdb.dbo.sysmail_sentitems - sql-server

Can anyone please tell me the name of Master table used by sqlserver 2008 to store dbmail information?
I tried to truncate "sysmail_sentitems" table but it gives me foreign key constraint violation error. Please reply if anyone knows.

You are trying to truncate sysmail_sentitems which is a view, I doubt that possible.
Master table used by sqlserver 2008 to store dbmail information is msdb.dbo.sysmail_mailitems.
I navigate through SP_Helptext sysmail_sentitems which give another view sysmail_allitems. Using SP_Helptext sysmail_allitems gives me a table sysmail_mailitems.
I think sysmail_mailitems is the table which you need.

Related

Apply TDE on database SQL Server success, but later show not encrypted

I would like to ask about encryption M.S SQL Server 2016.
I have applied encryption on database production long time, but a few months later
It show status not encrypted.
What happen to it?
Note
Table sys.dm_database_encryption_keys" no database in this table
Table sys.certificates" have certificate name
Table sys.databases" have database name in this table
Thank you so much for your kindly help.

Migrating access to SQL Server

I've been asked to supervise the migration from an MS Access database to SQL Server. The tool being used is SSMA for Access.
During the progress we have been facing an issue
Synchronization Error: The foreign key cascading '[table name]' can not be created where the column reference '[table name].Codigo' is an identity column.
Is there any way to solve this without altering the structure of the table? We are facing this problem on multiple tables and it'd take ages to change the structure of the all.
Thanks in advance
You could shut off the identity checking by
SET IDENTITY_INSERT [table name] ON
Do your insert into SQL and then
SET IDENTITY_INSERT [table name] OFF

Give user different grant in one database sqlserver 2008

I am trying to give users different grants into a database. I Know how to do this graphically in SQL Server 2008, but how can I do this with SQL code.
I know to do this for a table for example
GRANT SELECT, INSERT, UPDATE ON dbo.YourTable TO YourUserName
But how to make this not only for one table but for the entire DB.
I have tried it like above with the name of database , but it does not function....How can I do this? Please help me?
If you know how to do it graphically (I assume you mean with SSMS or another tool), than turn on the SQL Profiler and capture the TSQL statements that SSMS emits when it does it - you can learn exactly how to do any such task.

Split database to different SQL Server

Sorry for my English.
There is database on SQL Server 2005 Enterprise. I wrote program which splits all tables on fileGroups by datetime. But the problem is that database schema is not designed for it and most information stays on the PRIMARY filegroup.
Please tell me how I can spread (split) tables onto two or more database servers for increased performance?
Are you looking for the syntax on how to move a table from one file group to another? See ALTER TABLE
ALTER TABLE dbo.MyTable
MOVE TO MyNewFileGroup
It sounds to me like you need to look into MS SQL Server's partitioning capabilities. You should not be doing this manually. Let the database solve that issue for you.

SQL Server 2008 won't let me add foreign keys

I've been using SQL Server for years, so I'm not a noob. I've recently been having problems where I can't add a foreign key to certain tables in my database using SQL Management Studio and SQL Server 2008 Express. The table I'm trying to reference is there and it has a primary key (with the primary key constraint created), but it doesn't show up in the list of tables that I can choose from when I'm trying to add the FK.
If I try and add the FK through plain old T-SQL, the query succeeds, but if I view the new FK using the UI, the primary key table dropdown is empty. The FK is there and it actually does work if I try to insert some data that would violate the constraint.
Anyone know why this would be happening?
This sounds like a tool issue (SSMS), not an engine issue
Thoughts:
close/reopen SSMS (caching?)
patched to same version as server install?
different schema etc?
Edit, after comment and it's SSMS caching:
You can also right-click on the table node and refresh so SSMS updates the cache. This problem goes back to SQL Enterprise Manager and SQL 2000. No known fix after 10 years...

Resources