Posts

Showing posts from May, 2017

Using Python GUID 'tkinter' for displaying Menu and Toolbar sample

from tkinter import * def Test(): print ( "Testing!" ) root = Tk() # create a menu menu = Menu(root) root.config( menu =menu) filemenu = Menu(menu) menu.add_cascade( label = "File" , menu =filemenu) filemenu.add_command( label = "New" , command =Test) filemenu.add_command( label = "Open..." , command =Test) filemenu.add_separator() filemenu.add_command( label = "Exit" , command =Test) helpmenu = Menu(menu) menu.add_cascade( label = "Help" , menu =helpmenu) helpmenu.add_command( label = "About..." , command =Test) # create a toolbar toolbar = Frame(root) b = Button(toolbar, text = "new" , width = 6 , command =Test) b.pack( side =LEFT, padx = 2 , pady = 2 ) b = Button(toolbar, text = "open" , width = 6 , command =Test) b.pack( side =LEFT, padx = 2 , pady = 2 ) mainloop() Here is a sample to play with.

How to backup multiple SQL Server Databases in SQL Server

Example: You need to take backup of multiple databases from SQL Server Instance and be created with date_time. Below is a script you can use(Cursor); USE MASTER GO DECLARE @BackupPath varchar(100) --Provide the backup path SET @BackupPath = 'C:\Backup\' DECLARE @DBName AS varchar(200) DECLARE Cur CURSOR FOR --Change the select query for the DBs you like to backup SELECT  name FROM    sys.databases WHERE   database_id >4  --(i.e excluding the following 'master, tempdb, model and msdb') OPEN Cur FETCH NEXT FROM Cur INTO @DBName WHILE @@FETCH_STATUS = 0 BEGIN   DECLARE @SQL varchar(max) = NULL   DECLARE @DBNamewithDateTime varchar(128) = NULL   SET @DBNamewithDateTime = @DBName + '_' + REPLACE(CAST(GETDATE()        AS date), '-', '') + '_' + REPLACE(CAST(CAST(GETDATE() AS time)        AS char(8)), ':', '')   SET @SQL = 'BACKUP DATABASE [' + @DBName + '] TO  DISK = N''' +