SQL Select Beginning and End of Months

select
CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(getdate())-1),getdate()),101) as [Beginning of this month]
,CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,getdate()))),DATEADD(mm,1,getdate())),101) as [End of this month]

, CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,getdate()))-1),DATEADD(mm,1,getdate())),101) as [Beginning of next month]
,CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,getdate()))),DATEADD(mm,2,getdate())),101) as [End of next month]

, CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,getdate()))-1),DATEADD(mm,2,getdate())),101) as [Beginning of two months from now]
,CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,getdate()))),DATEADD(mm,3,getdate())),101) as [End of two months from now]

, CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,getdate()))-1),DATEADD(mm,3,getdate())),101) as [Beginning of three months from now]
,CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,getdate()))),DATEADD(mm,4,getdate())),101) as [End of three months from now]

Connect to a Server on a Different Network in Windows 10

My work PC’s IP address is 192.168.1.99 and a server that I recovered from a co-location facility has a static IP of 10.15.20.180.  So, of course, when I connected the server to our network and ping 10.15.20.180, I get no replies.

ping1Capture

I go to Control Panel > Network and Internet > Network Connections, right-click, Properties, select Internet Protocol Version 4 (TCP/IPv4) and click Properties.

network0Capture

Our network, like most, has a DHCP service.  I’ll need to change to a static IP so that I can add a second IP address to the NIC (multihomed).  I’ll run ipconfig /all to get my current IP.

ipconfig0Capture

Select the Use the following IP address: radio button, retype my static IP information then click Advanced.

network1Capture

Under the IP address section click the Add button and enter an IP address and Subnet mask in the same class as the server I’m trying to connect to – in this case I used 10.15.20.99 and 255.255.255.0.

network2Capture

Click OK to all of that and run ipconfig /all to confirm the additional IP address.

ipconfig1Capture

Now I ping 10.15.20.180 and I get replies.

ping2Capture

And I can remote into the server.

Notepad++ remove duplicates, remove blank lines and sort data in one operation

http://www.cathrinewilhelmsen.net/2012/05/16/notepad-remove-duplicates-remove-blank-lines-and-sort-data-in-one-operation/

Notepad++ with the TextFX plugin makes it quick and easy to remove duplicates, remove blank lines and sort data in one operation. This is a typical case where Excel does the job, but as I always have Notepad++ open it is fast and easy to get the results I want in just a few seconds.

remove duplicates, remove blank lines and sort data in one operation

1. Paste the text into Notepad++ (CTRL+V).

2. Mark all the text (CTRL+A). Click TextFX → Click TextFX Tools → Check +Sort outputs only UNIQUE (at column) lines (if not already checked).

3. Click TextFX → Click TextFX Tools → Click Sort lines case insensitive (at column)

4. Duplicates and blank lines have been removed and the data has been sorted alphabetically. (The first line that may appear empty contains a space, which is regarded as a character and is included in the list of unique data.)

Add Text at Start and End of Each Line Notepad++

Notepad++ is a very useful text editor for every programmer, sadly its not yet available on the Mac OSX,

If you are in a situation where you want to put some text at the start of each line in your text, or at the end of each line , or both , well you can achieve this in notepad++ using the Find and Replace option using Regular Expression.

Check out how you can do it,

Step 1: Open Your text in Notepad++

Insert text at the beginning and end of each line notepad++

Step 2: To add Text at the Start of each line

    Press Ctrl+F to open Find window, click on the Replace tab, check that you have selected Regular Expression option, now add ^ in the Find textbox and the text you want at the start of each line in the Replace textbox, and click Replace all.

 

Find and Replace notpad++ to insert text at start

Step 3: To add Text at the End of each line

    Press Ctrl+F to open Find window, click on the Replace tab, check that you have selected Regular Expression option, now add $ in the Find textbox and the text you want at the End of each line in the Replace textbox, and click Replace all.

 

Find and Replace notpad++ to insert text at end

Step 4: Result

Result notepad++

 

    This trick is very useful when transforming a text into sql queries.

http://code2care.org/pages/add-text-start-end-each-line-notepad-plus-plus/