Hi,
I am getting error because of this line in stored procedure.How to enclose string value.
Count(Case When Totalhours<='25 :0' Then EmpNo end) as Less.
25:0 is varchar datatype so i am enclosing in quotations. -
-
ALTER PROCEDURE [dbo].[SAR_Sp_GetScheduledHours](@date1 DATETIME, @date2 DATETIME, @date3 DATETIME, @date4 DATETIME)
-
AS
-
DECLARE @query VARCHAR(MAX)
-
BEGIN
-
SET @query = 'SELECT '+ CHAR(39) + 'Forecasted HC as per Hiring Plan' + CHAR(39) + ' AS HeadCount, [' + CONVERT(VARCHAR,@date1,101) + '], [' + CONVERT(VARCHAR,@date2,101)+ '], [' + CONVERT(VARCHAR,@date3,101) + '], [' + CONVERT(VARCHAR,@date4,101) + ']' +
-
'FROM
-
(SELECT WeekStartDate,
-
Count(Case When Totalhours<='25:0' Then EmpNo end) as Less
-
FROM TestTable1 group by WeekStartDate)
-
AS SourceTable
-
PIVOT
-
(
-
max(Less)
-
FOR WeekStartDate IN (' + '[' + CONVERT(VARCHAR,@date1,101) + '], [' + CONVERT(VARCHAR,@date2,101)+ '], [' + CONVERT(VARCHAR,@date3,101) + '], [' + CONVERT(VARCHAR,@date4,101) + ']' + ')
-
) AS PivotTable'
-
EXEC(@query)
-
END
1 1241 Frinavale 9,735
Recognized Expert Moderator Expert
This question is better suited for a database expert.
What database management system are you using?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: John |
last post by:
Does anyone have any suggestions on a way to automate sending an
Access pivot (query) using VBA Access and Outlook?
|
by: maneeshkhare |
last post by:
I am trying to update a field in Access db (.mdb) via a DataSet using
the following code. I am continously getting this error:
Has anybody seen this before?
1. If I try using the same code for any other .mdb file, it works
perfectly.
2. This is a Winform application, so no problems about the ASPNET wp
being granted rights.
|
by: Tore Halset |
last post by:
Hello.
I am trying to port an old java application from MS SQL Server to
PostgreSQL running on Mac OS X. I have access to the java source code
and can make modifications. I have tried with PostgreSQL version 7.4.2
and 8.0.0beta2, but get the same error. I am using pgdev.305.jdbc3.jar
for 8.0.0beta2. The PostgreSQL installation are standard, except for
log_statement = 'all' to debug this problem.
The problem is that the server returns...
|
by: tyngtyng |
last post by:
hi...
i'm new to the php and now i'm getting an error to insert my data inside the form..and also undefined index in latest_updated......
Now,i'm having trouble catching what i'm doing wrong....Here's my code to the query entry...
<?php
include 'config.php';
$pili_id=$_POST;
$branch=$_POST;
|
by: chitara |
last post by:
is there any posibility to block mysql port or someting?
I am getting "Error ,query failed" during adding any data through the admin panel of that website:-(
same softwares(php, mysql and IIS) with the same script woking fine in my local server but in the main webserver its giving the above message. More over couldn't edit the data also over there.
Thats why I am asking, is there any posibility.............
I don't have permission to...
| |
by: mrityunjay11 |
last post by:
Error
SQL query:
CREATE TABLE per(
item_name varchar,
item_number int,
payment_status int,
payment_amount int,
payment_currency int
);
|
by: srinivasan2009 |
last post by:
Hi,
While Running macro i am getting error in a particular query "Numeric field overflow"
For which i am opening that query and just saving the query. and query is starts executing..
Whether any solutions ....Pl reply with your feedback
|
by: rajesh0303 |
last post by:
Query gives error : Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression
Query is :
select AlertGroupAssignment.AlertGroupAssignmentID,OPCAlert.AlertID,OPCServer.OPCServer,OPCItem.OPCItem,OPCAlert.AlertType,OPCAlert.AlertValue,OPCAlert.Severity,OPCAlert.Active,OPCAlert.Description from OPCAlert,AlertGroupAssignment,OPCItem,OPCServer where...
|
by: Pradeep23 |
last post by:
There are three computers A,B and C
A is Manager' computer in which Data is stored as File System
B is my desktop having SQL Server 2005
C is Main SQL Server 2005.
B is able to connect to C. But When I run query on C, I get error.
The query runs but Files are not getting loaded.
It simply says File not Found.
|
by: NareshN |
last post by:
Hi,
I am getting error in following stored procedure in where condition Must declare the scalar variable "@CampaignId".I already declared CampaignId but still getting error.Please see where condition which is in bold letters.
If i give value its working like where CampaignID=1
alter PROCEDURE SAR_Sp_GetForecastedHC(@date1 DATETIME, @date2 DATETIME, @date3 DATETIME, @date4 DATETIME,@CampaignId int)
AS
DECLARE @query VARCHAR(MAX)
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |