Showing posts with label wrotegt. Show all posts
Showing posts with label wrotegt. Show all posts

Monday, March 12, 2012

Query to get name of views which reference a give column from

I have 3 to 4 tables with the same column names, so it displays views for al
l
the tables ,
any additions '
Thanks a Lot
"Alejandro Mesa" wrote:
> Rodger,
> check view INFORMATION_SCHEMA.COLUMNS
> Example:
> use northwind
> go
> declare @.cn sysname
> set @.cn = N'OrderID'
> select TABLE_NAME
> from INFORMATION_SCHEMA.COLUMNS
> where COLUMN_NAME = @.cn and
> objectproperty(object_id('[' + TABLE_SCHEMA + '].[' + TABLE_NAME + ']'),
> 'IsView') = 1
> go
>
> AMB
> "Rodger" wrote:
>use information_Schema.view_column_usage
"Rodger" wrote:
> I have 3 to 4 tables with the same column names, so it displays views for
all
> the tables ,
> any additions '
> Thanks a Lot
> "Alejandro Mesa" wrote:
>|||It worked...great... never tried these wonderful views.
Thanks
rodger
"Omnibuzz" wrote:
> use information_Schema.view_column_usage
> "Rodger" wrote:
>|||Check out all the view in INFORMATION_SCHEMA. if you are interested. gives a
lot of metadata. And if you have no further questions can you close this
thred.
Thanks
Omnibuzz
"Rodger" wrote:
> It worked...great... never tried these wonderful views.
> Thanks
> rodger
> "Omnibuzz" wrote:
>

Saturday, February 25, 2012

Query that automatically deletes records that are older than 3

Thanks Tom, great help now that i know that where do i create it so that it
runs automatically? would it be a UDF?
thanks
"Tom Moreau" wrote:

> Leave out the column names:
> DELETE FROM [dbo].[RECadvert]
> WHERE RECadDatePosted < DATEADD(dd,-365,getdate())
>
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> ..
> "GTN170777" <GTN170777@.discussions.microsoft.com> wrote in message
> news:84131850-B81C-4878-84CD-BC8C0116AD56@.microsoft.com...
> Hi all,
> I'm trying to build a self running query that deletes all records that are
> older than 365 days. the code i've used is -
> DELETE RECadvertId
> RECadRecruiterId
> RECadreference
> RECadjobtype
> RECadLocation
> RECadJobTitle
> RECadSalary
> RECadcategory
> RECadduration
> RECadstartdate
> RECadDatePosted
> RECadCompanyID
> RECadDescription
> RECadDescriptionshort
> RECaddayspostedfor
> RECadBenefits
> FROM [dbo].[RECadvert]
> WHERE RECadDatePosted > DATEADD(d,365,RECadDatePosted)
> It isn't working, any ideas?
> thanks
>Make a sql server task to run once a day. write the script into it to
execute
"GTN170777" <GTN170777@.discussions.microsoft.com> wrote in message
news:62833ACE-EC24-464B-A19E-AD0FEE340AB4@.microsoft.com...
> Thanks Tom, great help now that i know that where do i create it so that
> it
> runs automatically? would it be a UDF?
> thanks
> "Tom Moreau" wrote:
>|||How do you do that?
"Mubashir Khan" wrote:

> Make a sql server task to run once a day. write the script into it to
> execute
> "GTN170777" <GTN170777@.discussions.microsoft.com> wrote in message
> news:62833ACE-EC24-464B-A19E-AD0FEE340AB4@.microsoft.com...
>
>|||From Enterprise Manager:
1) Go to Management->SQL Server Agent->Jobs
2) Right-click and select New Job
3) Fill in the appropriate bits. such as steps and schedules.
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
"GTN170777" <GTN170777@.discussions.microsoft.com> wrote in message
news:CE1E0AA5-EAA2-4562-BB07-1B1C27CE9861@.microsoft.com...
How do you do that?
"Mubashir Khan" wrote:

> Make a sql server task to run once a day. write the script into it to
> execute
> "GTN170777" <GTN170777@.discussions.microsoft.com> wrote in message
> news:62833ACE-EC24-464B-A19E-AD0FEE340AB4@.microsoft.com...
>
>