Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by JayKusch

  1. JayKusch

    Identify a Snapshot DB

    Is there a system parameter like DATABASEPROPERTYEX that would identify whether a DB is a snapshot? Thanks! Thanks J. Kusch
  2. JayKusch

    Get date of previous Sunday

    Morning, I know I am close BUT I still can't get this code snippette to return the date of last sunday (as in 1/9/2011 - format of date does not matter). Here is what I have so far (borrowed from a web page): DECLARE @LastSundayNight DateTime SET @LastSundayNight = GetDate() SELECT CASE...
  3. JayKusch

    Too much egg nog - Query Help - lol

    PERFECT! Thanks J. Kusch
  4. JayKusch

    Too much egg nog - Query Help - lol

    I am trying to update a record set with the last restore date that is captured with a TOP clause in the code. Here is the code (that does not work): UPDATE MyTable SET MyDate = ( SELECT TOP 1 RESTORE_DATE FROM MSDB.dbo.RESTOREHISTORY WITH (nolock) JOIN MyTable ON...
  5. JayKusch

    Remote Call insert local table from exec of a remote SP

    OK .. brain dead for a Friday - lol So I have a server where I am "trying" to call a remote stored proc to load a local table. Somthing like ... INSERT INTO Admin.dbo.MyTable ( Col1, Col2 ) EXEC MyRemoteDB.dbo.MySP Now Admin.dbo.MyTable is the local table and MyRemoteDB.dbo.MySP...
  6. JayKusch

    OpenRowSet query being refused

    I have an instance of 08R2 running on my box with an instance of 05SP3. Running the query in the 05 instance returns the result sets from the remote server just fine. When I run it from the R2 instance it failes with the followig error: OLE DB provider "SQLNCLI10" for linked server "(null)"...
  7. JayKusch

    Line up commands in Mgt Studio

    Bingo! Thanks Bill Thanks J. Kusch
  8. JayKusch

    Line up commands in Mgt Studio

    Just the reverse for me ... works in 05 (some setting I hit quite a while back) but not in 08R2. Trying to hunt down where its set at. Thought it was a part of IntelliSense. Thanks J. Kusch
  9. JayKusch

    Line up commands in Mgt Studio

    I know I have toggled it on in the past but where do you set Mgt Studio to show you how your commands line up? In other words, If I use an IF\ELSE statement I want to be able to highlight the IF and it shows me the corresponding ELSE further down in the code. Thanks! Thanks J. Kusch
  10. JayKusch

    Simple Insertion of records

    OK ... figured it out ... INSERT INTO TableB (DBName, Field1, Field2, Field3) SELECT [Name], '', 0, 0 FROM Master.dbo.SysDatabases WHERE NOT EXISTS (SELECT * FROM TableB WHERE TableB.DBName = Master.dbo.SysDatabases.[Name]) AND Status = 536 Thanks J. Kusch
  11. JayKusch

    Simple Insertion of records

    Looking to stay away from triggers. Want to do this code-wise. I will keep working at it. Thanks Thanks J. Kusch
  12. JayKusch

    Simple Insertion of records

    Ahhh ... one issue ... using SysDatabases (system table) so we cannot add that trigger. Looking for code that would look something like: If database(s) in sysdatabases set to offline then add database NAME from SysDatabases to TableB IF it does not already exist. If it exists already in...
  13. JayKusch

    Simple Insertion of records

    TableA has database name column and active\inactive flag TableB has database name When we inactivate database(s) in TableA we want code later on to insert the newly deactivated database(s) name(s) into TableB. I know code with use an IF NOT EXIST on the TableB insertion code, just not able to...
  14. JayKusch

    UPDATE Statement dilema

    I have a table (TableA) that needs to have a date field updated with a MAX(Date) from another table (TableC). To add to this ... We need to join to a TableB to get an ID to have it hook up right. So TableA looks like: DBName varchar(100), CreateDate DateTime TableB looks like: DBName...
  15. JayKusch

    MSForEachDB - Create Stored Proc

    I figured it out use the ole nasty 'cursor' - lol Thanks! Thanks J. Kusch

Part and Inventory Search

Back
Top