Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

Convert Text to VarChar

Posted on July 10, 2013October 26, 2015 By David Kittell
CONVERT(varchar(8000),col1)

Example: IP is varchar(50) and Hostname is Text

Not sure why you would ever have a need for this but this is an example that works.

SELECT id
	,DATETIME
	,('IP Address:' + ipaddress) AS "IP Address"
	,('Hostname: ' + CONVERT(VARCHAR(8000), hostname)) AS "Hostname"
FROM pageview

More practical use

SELECT id
	,DATETIME
	,(ipaddress + ' | ' + CONVERT(VARCHAR(8000), hostname)) AS "IP Address"
FROM pageview
Originally Posted on July 10, 2013
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Code MSSQL

Post navigation

Previous post
Next post

Related Posts

Azure PowerShell – Create Virtual Network Within Resource Group

Posted on December 29, 2016

This is still a work in progress to include all the variables but the script below will create a Resource Group then create a Virtual Network with 3 subnets and a gateway along with custom DNS. # Main Reference: https://docs.microsoft.com/en-us/azure/virtual-network/virtual-networks-create-vnet-arm-ps Clear Write-verbose "Setting Environment Variables – Start" $VNetName = “azuredev-eastus-vnet”…

Read More

Folder Exists

Posted on December 14, 2013October 26, 2015

Public Function FolderExists(ByVal FolderPath As String) As Boolean Dim f As New IO.DirectoryInfo(FolderPath) Return f.Exists End Function If FolderExists("c:windows") = False Then ‘Folder Does’t Exist Else ‘Folder Does Exist End If Originally Posted on December 14, 2013Last Updated on October 26, 2015 All information on this site is shared with…

Read More

Unix Shell – Set/Change IP

Posted on October 19, 2015October 19, 2015

By default UNIX computers/servers are setup with a DHCP/Dynamic IP address, below is how to change the IP to static Before you do either process understand what these settings should be: Network Interace you plan to modify (eth0, eth1, etc.) IP Address (address) Subnet Mask (netmask) Default Gateway (gateway) Whether…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • Open On Screen Keyboard (OSK)
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes