troubleshooting Question

insert failed in sql

Avatar of Johny Bravo
Johny Bravo asked on
.NET ProgrammingASP.NETMicrosoft SQL Server 2005
8 Comments2 Solutions226 ViewsLast Modified:
Hi Experts,
I am trying to insert one line in my sql table.Actually the data that I want to insert is the problem.
The column datatype is ntext.
The data I want to insert in the column is a sql query.
Following is the data(the sql statement) is the actual data that i want to insert in the column.

SELECT DISTINCT PTS.PrResourceId As Resource_id,
(SR.First_Name+ ' ' + SR.Last_Name) AS Resource_Name,
  Niku.z_task_name(PBS.slice_date,PTS.PrResourceId) AS TASK_NAME,
(SELECT Last_Name + ', ' + First_Name From  cmn_sec_users Where ID=SR.MANAGER_Id)Resource_Manager,
 DAY(PBS.slice_date)Rcount,
 ( DATENAME(month,'2/7/2008') + ',' + CONVERT( VARCHAR(20),DATEPART(yyyy,'2/7/2008')))Month_Name,
 ( SELECT NAME FROM NIKU.PRJ_OBS_UNITS WHERE ID=( '5001078' ) )DEPARTMENT_NAME
 FROM Niku.PrTimesheet PTS, Niku.PrTimeentry PE

How can I achieve this?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros