How I can get the first 3 digits in 123456 Numbers in sql?

sql, sql-server-2000, t-sql

Solution

if `CallingParty` is of type int:

SELECT CAST(LEFT(CallingParty, 3) AS INT)
From CDR

Problem

I have field called CallingParty in My CDR table it contains data like this: ``` CallingParty ------------ 267672668788 ``` I want to select the first 3 number of each of those numbers like ``` CallingParty ------------ 267 ```

Original source

Related problems