ALTER PROCEDURE [dbo].[usp_AppProjectDetail]
AS
Declare @iCount as Int ;
SET @iCount = (select Count(*)
FROM
(
SELECT
Project.ProjID,
Quarters.QTR_ID,
UpldProjectDetail.ProjName,
Department.DepartmentID,
UpldProjectDetail.MultiPD...
Declare @iCount as Int
SET @iCount = SELECT Count (*) FROM
(
SELECT
ProjectDetail_Q.ProjNo
ProjectDetail_Q.ProjectNme
Quarters.SnapshotDate
FROM ProjectDetail_Q
LEFT Join.......
)
IF @iCount = 100
BEGIN
Your INSERT goes here
END
Declare @iCount as Int
SET @iCount = SELECT (Count (*) FROM
(
SELECT
ProjectDetail_Q.ProjNo
ProjectDetail_Q.ProjectNme
Quarters.SnapshotDate
FROM ProjectDetail_Q
LEFT Join.......
)
IF @iCount = 100
BEGIN
Your INSERT goes here
END
can anyone please help on the best way to compose the Logic for the following sample stored proc.
1.the main body is INSERT INTO SELECT .....sql
2.The select part returns 100 rows for example .
how do I write the code to run the INSERT ONLY if 100 rows are returned
Create procedure...
thanks All for your help and suggestion .
Isaac I think you are right . no shortcuts but I found a good link that helps generate the column lengths faster although I still have to compare the source and target manually with the bare eyes...
I'm running the query in SSMS . No it doesnt tell the column am afraid. the error Msg points to the 1st line of the insert query which doesnt tell me anything . am running SQL Server 2012. maybe this error tells you the column in later versions . ive googled this error and unfortunately I can...
Hi
I am executing an
INSERT INTO
Column1
Column2
SELECT FROM
Column1
Column2
Statement with about 50 columns and getting the
String or binary data would be truncated error .SQL doesnt tell you which column is the issue
does anyone know the fastest way to find out the culprit...
Apologies , ive now modified the code and this is the response I got from my colleague that wrote the Access query .
this is the response I got
the aim of the CODE is to find '0' and change to NULL . the data values might be coming in from the Source Application as null or blank but when...
just a quick question please and a bit confusing
is SQL Having a problem with the value 'N/A' because the other values in those columns are 'Green', 'Amber' etc
as you can see from the code . I only get the error in the WHERE Clause but no error in the CASE part of the code before the...