Creator of a column - SQL Server - sql

How to find the creator of a column in SQL Server?
I checked sys.column table but only getting the created and modified date. With these two fields I also need the Creator of the column.
By Creator I mean the userid which is used to login to sql server.

Possibly you can not but if you change the column recently than you can try to find it in the below way
This report provides a history of all committed DDL statement executions within the Database recorded by the default trace.

Related

SQL Server tracking changes in data coming from Oracle link

I have a SQL Server table that I create by selecting from an Oracle view using a database link. The Oracle database is fully wrapped and comes from an external vendor.
The table has a text field for the current month's update. It doesn't have any dates or IDs. When I run the procedure to get the data I don't have any idea if the value has been the same for the last few months or had been updated, I have no idea when it was updated. I thought of going through the query row by row and detecting if the value is there and if it isn't, insert a new row with a creation date. This will provide a monthly row with any updates, keeping the older updates linked to the correct date. Maybe. I'm no expert and couldn't think of a way. Would this break? How would you solve my problem?
I don't have DBA rights in any databases.

SQL Server: Create a duplicate of a database without the data

I have a database called AQOA_Core with huge amount of data.
I have a newly created database called AQOA_Core1 which is basically empty. I want to write a query to duplicate AQOA_Core to AQOA_Core1 without the data. I guess to be precise I want to create a skeleton of the primary database into the secondary database.
PS: I use Toad for my database operations.
You can use SQL Server Script Wizard for scripting database objects. You can exclude data, and select the database object types you want to include in your script
Please check the SQL Server guide I referenced above,
I hope it helps you

Updating in Tables in SQL Server 2008 [duplicate]

This question already exists:
I need to update two tables in SQL [closed]
Closed 8 years ago.
I need to update one table from one database to another table on another database. This will need to be run once a day. Both tables are the same structure.
One database is called pvc_rds and the other is called kiosk. The table is REC_Materials. There is a column called sid that is unique. Both these live on the same SQL Server 2008.
I am new to this so any help would be appreciated. Thanks
The simple answer is to create a scheduled job, which contains a step that queries the source server (source database) and insert into the target database. However, you must use the complete name of the object, as described here: http://technet.microsoft.com/en-us/library/ms187879(v=sql.105).aspx
The more complicated answer depends on your overall goal. Is the source database, a transaction database and the target database the reporting database? In which case, is your goal to replicate the data using transaction or merge replication?
Use (at least) a three-part identifier.
The complete name of an object is made up of four identifiers: the server name, database name, schema name, and object name. They appear in the following format:
server_name.[database_name].[schema_name].object_name
In your case, this would simply translate to (assuming the dbo schema for your tables) :
UPDATE pvc_rds.dbo.REC_Materials
FROM pvc_rds.dbo.REC_Materials
INNER JOIN kiosk.dbo.REC_Materials
ON pvc_rds.dbo.REC_Materials.sid = kiosk.dbo.REC_Materials.sid
in order to synchronise existing records present in both databases. You can expand on this to remove records that shouldn't be there anymore and add any new records. You can save that process into a job, and make it run everyday by scheduling it.

I need to know the ids of inserted,updated,deleted in Microsoft Sql Database 2012 with dates

I want to sync my local db with microsoft sql database so I need to know the ids of added records , updated and deleted records after last sync date, I mean I have the last sync date and I need to get all these ids after that date
is microsoft sql server store this information in logs or anywhere ?
This isn't logged anywhere by default unless you either create a mechanism yourself to store the information or perhaps use Change Data Capture as documented here:
Change Data Capture
This allows SQL server to track data that changes in a table and then exposes the changes via functions that you can call to retrieve the data that has changed with each sync.

Delete column in SQL Server after a period from creation

I am working with sensitive/private files stored in SQL Server as VarBinary(MAX). Is there a way to tell the database or nHibernate to nullify the column after a period of time after its creation.
Make sure to put a timestamp column on the table, then set up a SQL Scheduled Job with a query to delete those rows periodically based on that time.
Absolutely not
Imagine the fun when SQL Server decides to change data apparently on it's own because the code monkey fluffed setting up whatever mechanism would be used...
You could (off top of my head):
Encrypt the columns
Schedule a clean up (SQL Agent job, a config table)
Don't use SQL Server for the files themselves, just store paths/links