473,772 Members | 2,411 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can I typecast like this while passing a comaseperated string?

63 New Member
set ANSI_NULLS ON
set QUOTED_IDENTIFI ER ON
go


-- =============== =============== ===============
-- Author: Lokesh Rao V.L
-- Create date: 18 June 2007
-- Description: Adds, updates LogCompliance details.
-- =============== =============== ===============
ALTER PROCEDURE [dbo].[logLogComplianc eAddUpd]
@loginUserId Int,
@logId Int,
@complianceIds Varchar(4000),
@logComplianceA nswers Varchar(4000),
@createdByIp Varchar(50),
@errNumber Int Output

AS
BEGIN

-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
SET CONTEXT_INFO @loginUserId;
SET @errNumber = 0

DELETE FROM LogCompliance WHERE LogId = @logId

DECLARE @answer Int, @pos1 Int, @complianceId Int, @pos2 Int
SET @pos1 = CHARINDEX(',' , @logComplianceA nswers , 1)
SET @pos2 = CHARINDEX(',' , @complianceIds , 1)

WHILE @pos1 > 0
BEGIN
SET @answer = Convert(Int,LTR IM(RTRIM(LEFT(@ logComplianceAn swers, @pos1 - 1))))
SET @logComplianceA nswers = RIGHT(@logCompl ianceAnswers, LEN(@logComplia nceAnswers) - @pos1)

SET @complianceId = Convert(Int,LTR IM(RTRIM(LEFT(@ complianceIds, @pos2 - 1))))
SET @complianceIds = RIGHT(@complian ceIds, LEN(@compliance Ids) - @pos2)

SET @pos1 = CHARINDEX(',', @logComplianceA nswers, 1)
SET @pos2 = CHARINDEX(',', @complianceIds, 1)

INSERT INTO [LogCompliance]
(
[ComplianceId]
,[LogId]
,[ComplianceAnswe r]
,[SortOrder]
,[CreatedDate]
,[LastModifiedDat e]
,[CreatedById]
,[LastModifiedByI d]
,[CreatedByIp]
,[LastModifiedByI p]
,[RecordStatusId]
)
VALUES
(
@complianceId,
@logId,
@answer,
0,
getDate(),
getDate(),
@loginUserId,
@loginUserId,
@createdByIp,
@createdByIp,
1
)
END

END


Can I typecast like this and into database?
Mar 20 '08 #1
0 788

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2093
by: Lars Plessmann | last post by:
I have a problem with typecast methods. Here is a setter of an object: function setKind($kind) { if (is_int((int)$kind) and (strlen($kind)<=6)) { $this->kind = $kind; return true;
9
11836
by: Venkat | last post by:
Hi All, I want to typecast int to std::string how can i do it. Here is the sample code. int NewList; //Fill the NewList with integers values. .......
1
2225
by: masood.iqbal | last post by:
I have a few questions regarding overloaded typecast operators and copy constructors that I would like an answer for. Thanks in advance. Masood (1) In some examples that I have seen pertaining to casting class A to class B, the implementation of the
3
2021
by: nandh_dp | last post by:
When the below program is compiled and executed, #include <stdio.h> #define MASK 0xFFFFFFULL main() { unsigned long long a; unsigned long b, c;
1
1315
by: nsj | last post by:
How to typecast double into ascii or string? Please help me.
8
4238
by: akolsen | last post by:
Hello there. This should be simple, but im having trouble anyway of getting it to work. I have a boxed object that i want to cast to its native type, but I would like to use reflection to do the typecasting. This is the regular way.
5
2311
by: SunnyDrake | last post by:
HI! I wrting some program part of it is XML config parser which contains some commands(for flexibility of engenie). how do i more simple(if it possible not via System.Reflection or System.CodeDom.CodeCastExpression) __problem typecast #1 Desc:i do needed checks but data/commands in XML is dynamic and i don't wanna fix C# code again and again... Sample:foreach (object some in somearray) (some.GetType())some.someaction();
3
4087
by: ryan.gilfether | last post by:
I have a problem that I have been fighting for a while and haven't found a good solution for. Forgive me, but my C++ is really rusty. I have a custom config file class: class ConfigFileValue { public: operator string(); // allow this class to be typecast into a string operator char*(); // allow this class to be typecast into a char*
1
8198
by: niharnayak2003 | last post by:
Hi All, I am facing the problem in Typecast inside the Generic class. I need a function which will take two param 1:-Xpath 2:- XMLDOC and return me what i will need. here is the code for accessing to the Generic class. private double mtrxgraphdata; private XMLdocument Matrixdata;
0
9621
marktang
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...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10264
Oralloy
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...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8937
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6716
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();...
0
5355
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...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4009
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.