You can use SUBSTRING
to do this:
SELECT
SUBSTRING(TRN02, 0, CHARINDEX('-', TRN02)) AS [First]
SUBSTRING(TRN02, CHARINDEX('-', TRN02) + 1, LEN(TRN02)) AS [Second]
FROM TABLE
More Related Contents:
- SQL Server – error when creating stored procedure
- SQL Server insert if not exists best practice [closed]
- An explicit value for the identity column in table can only be specified when a column list is used and IDENTITY_INSERT is ON SQL Server
- Are GUID collisions possible?
- Does a foreign key automatically create an index?
- best way to convert and validate a date string
- Why do table names in SQL Server start with “dbo”?
- Add alternating row color to SQL Server Reporting services report
- LIKE vs CONTAINS on SQL Server
- How do I enable MSDTC on SQL Server?
- How Do I Split a Delimited String in SQL Server Without Creating a Function?
- What’s the longest possible worldwide phone number I should consider in SQL varchar(length) for phone
- Is there any difference between DECIMAL and NUMERIC in SQL Server?
- How to enable bulk permission in SQL Server
- SQL Server history table – populate through SP or Trigger?
- Should every User Table have a Clustered Index?
- How to load an XML file into a database using an SSIS package?
- TSQL: Create a view that accesses multiple databases
- How to connect to MS SQL Server using Inno Setup?
- Check if a temporary table exists and delete if it exists before creating a temporary table
- SQL count rows in a table
- What is the sql connection string I need to use to access localhost\SQLEXPRESS with Windows Authentication or SQL Authentication?
- SQL Error with Order By in Subquery
- Executing set of SQL queries using batch file?
- How to change default language for SQL Server?
- Grant Select on a view not base table when base table is in a different database
- Database design: Calculating the Account Balance
- migrate data from MS SQL to PostgreSQL?
- Using Full-Text Search in SQL Server 2008 across multiple tables, columns
- Oracle sequence but then in MS SQL Server