Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 768855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:14:42+00:00 2026-05-14T18:14:42+00:00

I have been playing around with a quite complex SQL Statement for a few

  • 0

I have been playing around with a quite complex SQL Statement for a few days, and have gotten most of it working correctly.

I am having trouble with one last part, and was wondering if anyone could shed some light on the issue, as I have no idea why it isnt working:

INSERT INTO ExistingClientsAccounts_IMPORT
SELECT DISTINCT 
cca.AccountID, cca.SKBranch, cca.SKAccount, cca.SKName, cca.SKBase, 
cca.SyncStatus, cca.SKCCY, cca.ClientType, cca.GFCID, cca.GFPID, cca.SyncInput, 
cca.SyncUpdate, cca.LastUpdatedBy, cca.Deleted, cca.Branch_Account, cca.AccountTypeID
FROM         ClientsAccounts AS cca 
INNER JOIN
(SELECT DISTINCT ClientAccount, SKAccount, SKDesc, 
    SKBase, SKBranch, ClientType, SKStatus, GFCID, 
    GFPID, Account_Open_Date, Account_Update
FROM          ClientsAccounts_IMPORT) AS ccai 
ON cca.Branch_Account = ccai.ClientAccount

Table definitions follow:

CREATE TABLE [dbo].[ExistingClientsAccounts_IMPORT](
    [AccountID] [int] NOT NULL,
    [SKBranch] [varchar](2) NOT NULL,
    [SKAccount] [varchar](12) NOT NULL,
    [SKName] [varchar](255) NULL,
    [SKBase] [varchar](16) NULL,
    [SyncStatus] [varchar](50) NULL,
    [SKCCY] [varchar](5) NULL,
    [ClientType] [varchar](50) NULL,
    [GFCID] [varchar](10) NULL,
    [GFPID] [varchar](10) NULL,
    [SyncInput] [smalldatetime] NULL,
    [SyncUpdate] [smalldatetime] NULL,
    [LastUpdatedBy] [varchar](50) NOT NULL,
    [Deleted] [tinyint] NOT NULL,
    [Branch_Account] [varchar](16) NOT NULL,
    [AccountTypeID] [int] NOT NULL
) ON [PRIMARY]


CREATE TABLE [dbo].[ClientsAccounts_IMPORT](
    [NEWClientIndex] [bigint] NOT NULL,
    [ClientGroup] [varchar](255) NOT NULL,
    [ClientAccount] [varchar](255) NOT NULL,
    [SKAccount] [varchar](255) NOT NULL,
    [SKDesc] [varchar](255) NOT NULL,
    [SKBase] [varchar](10) NULL,
    [SKBranch] [varchar](2) NOT NULL,
    [ClientType] [varchar](255) NOT NULL,
    [SKStatus] [varchar](255) NOT NULL,
    [GFCID] [varchar](255) NULL,
    [GFPID] [varchar](255) NULL,
    [Account_Open_Date] [smalldatetime] NULL,
    [Account_Update] [smalldatetime] NULL,
    [SKType] [varchar](255) NOT NULL
) ON [PRIMARY]

The error message I get is:
Msg 8152, Level 16, State 14, Line 1
String or binary data would be truncated.
The statement has been terminated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T18:14:42+00:00Added an answer on May 14, 2026 at 6:14 pm

    The error is because you are trying to insert data into a column in ExistingClientsAccounts_IMPORT where the column size is smaller than the length of data attempting to be inserted into it.

    e.g.
    SKAccount column is VARCHAR(12) in the ExistingClientsAccounts_IMPORT table but is VARCHAR(255) in ClientsAccounts_IMPORT.

    So if ClientsAccounts_IMPORT contains any rows where that field is longer than 12 characters, you will get that error as obv. e.g. 100 characters will not fit into a 12 character field.

    You need to make sure all the columns in the table you are inserting into, are big enough – make sure each column definition matches the source table.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been playing around with the postgresql.conf file for a couple days now.
I have been working with PostgreSQL, playing around with Wikipedia's millions of hyperlinks and
I have been playing around with GTK since a couple of days now,while going
I have been playing around with silverlight for a couple of days now and
I have been playing around with the EF to see what it can handle.
I have been playing with the Linq to Sql and I was wondering if
I have been playing around with the Gowalla API, and was wondering if anyone
I have been playing around with jQuery for a bit now, and am really
I have been playing around with Rake and Albacore, to see if I can
I'm brand new to Google App Engine and have just been playing around with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.