Varchar To Bigint

Jan 2, 2008


I want to write the following query.


SELECT CASE WHEN Member.CuApplicationDocFK = 'NULL' THEN 'Existing' ELSE 'New' END AS MemberType
FROM Member


But the problem is Member.CuApplicationDocFK is bigint type. When I run the query it gives a error message saying "error converting data type varchar to bigint.

Can anyone tell me how to fix this please?

Thanks

View 5 Replies


ADVERTISEMENT

Change Datatype From Varchar To Bigint Not Working

Nov 14, 2007

Hello,

I would like to change the datatype on a particular column from varchar to bigint across 100's of tables within a database.

I have the command ready which is:

ALTER TABLE tablename ALTER COLUMN columnname BIGINT

The problem happening is that it seems there are constraints across all the columns in every tables.

The error message is:

Server: Msg 5074, Level 16, State 1, Line 1
The object 'DF__tablename__columnname__0ABD916C' is dependent on column 'columnname'.
Server: Msg 4922, Level 16, State 1, Line 1
ALTER TABLE ALTER COLUMN columnname failed because one or more objects access this column.

I understand that if I delete this constraint, then it will let me modify the datatype of the column, but since there are tons of them and they are randomly named, how do I achive changing the datatype across multiple tables in bulk.

View 1 Replies View Related

SQL 2012 :: Cast Varchar To Bigint Error

Mar 4, 2014

I try to run code but got an error. How to fix it?

SELECT Cast(('20140304800084500001') AS BIGINT)

Arithmetic overflow error converting expression to data type bigint

View 1 Replies View Related

Error Converting Data Type Varchar To Bigint.

Aug 25, 2005

I have the following query which has been giving me headaches for days :  SELECT SCCode [Service Catalog Code], FileName [File Name], FullName [Full Name], FileExtension [Extension], FileSize [Size],  Author [Author], CONVERT(VARCHAR(50),CAST(LastModified AS SMALLDATETIME), 120) [Last Modified],   CONVERT(VARCHAR(50),CAST(LastAccessed AS SMALLDATETIME), 120) [Last Accessed], TimesAccessed [Downloads],  UploadedBy [Uploaded By], CONVERT(VARCHAR(50),CAST(UploadedAt AS SMALLDATETIME), 120) [Uploaded At]  FROM #TempTable  WHERE id > @firstitem AND id < @lastitem  ORDER BY   CASE  WHEN @sortcolumn = 'Service Catalog Code' THEN SCCode    WHEN @sortcolumn = 'File Name' THEN FileName    WHEN @sortcolumn = 'Extension' THEN FileExtension    WHEN @sortcolumn = 'Size' THEN FileSize    WHEN @sortcolumn = 'Author' THEN Author    WHEN @sortcolumn = 'Last Modified' THEN CONVERT(VARCHAR(50),CAST(LastModified AS SMALLDATETIME), 120)    WHEN @sortcolumn = 'Last Accessed' THEN CONVERT(VARCHAR(50),CAST(LastAccessed AS SMALLDATETIME), 120)    WHEN @sortcolumn = 'Downloads' THEN TimesAccessed    WHEN @sortcolumn = 'Uploaded By' THEN UploadedBy    WHEN @sortcolumn = 'Uploaded At' THEN CONVERT(VARCHAR(50),CAST(UploadedAt AS SMALLDATETIME), 120)   END ASCWhen my @sortcolumn parameter is either FileSize (BIGINT) or TimesAccessed (BIGINT) then the query returns the data without any problem. However, if I use a different @sortcolumn value such as "Author" then I keep getting "Error converting data type varchar to bigint."A solution that seems to work is to drop CASE and use lots of IF statements instead. I don't prefer to do this because it requires me to repeat the same select statement for each and every possible @sortcolumn value!Does anyone know how to solve this? Help!

View 2 Replies View Related

Error Converting Data Type Varchar To Bigint

Oct 18, 2013

i have this data:

BookedIDBooked_Date
1141996362013-01-09 14:55:21.740

would like to get the output into txt format with delimited in between columns.

i tried this but getting this error: Error converting data type varchar to bigint.

select BookedID+'|'+Booked_Date from tableA

View 5 Replies View Related

Error Converting Data Type Varchar To Bigint

Oct 5, 2007

I have designed a SP where i need to update all the records for a table where ErrorId is not equal to the ones provided.In this stored procedure i am parsing and all the errorids delimited by ',' into a varchar variable which i would be using for updating the table.On the second last line i get the error mentioned in the subject line.any help would be appreciated.



ALTER PROCEDURE [dbo].[sp_ParseAndUpdateDetails]

@NozzleID int,

@ParserString varchar(MAX)

AS

BEGIN



DECLARE @NextPos int

DECLARE @LoopCond tinyint

DECLARE @PreviousPos int

DECLARE @FlgFirst bit

DECLARE @QueryCondition varchar(MAX)

SET @LoopCond=1

SET @NextPos =0

SET @FlgFirst=0

SET @QueryCondition=''

WHILE (@LoopCond=1)



BEGIN

--Retrieving the Position of the delimiter

SET @NextPos =@NextPos + 1

SET @NextPos = CHARINDEX(',',@ParserString, @NextPos)



--Retreiving the last substring

IF(@NextPos=0)

BEGIN

PRINT SUBSTRING(@ParserString,@PreviousPos + 1,(LEN(@ParserString)+1)- @PreviousPos)

SET @QueryCondition= @QueryCondition + ' AND ErrorId <> ' + CAST(SUBSTRING(@ParserString,@PreviousPos + 1,(LEN(@ParserString)+1)- @PreviousPos) AS bigint)

SET @PreviousPos = @NextPos

BREAK

END



--Retrieving the individual substrings

If @FlgFirst=0

--Retreiving the first substring

BEGIN

SET @FlgFirst=1

PRINT SUBSTRING(@ParserString,1, @NextPos-1)

SET @QueryCondition= @QueryCondition + CAST(SUBSTRING(@ParserString,1, @NextPos-1) AS bigint)

SET @PreviousPos = @NextPos

END

ELSE

--Retreiving the internmediate substrings

BEGIN

PRINT SUBSTRING(@ParserString,@PreviousPos + 1,(@NextPos-1)-@PreviousPos)

SET @QueryCondition= @QueryCondition + ' AND ErrorId <> ' + CAST(SUBSTRING(@ParserString,@PreviousPos + 1,(@NextPos-1)-@PreviousPos) AS bigint)

SET @PreviousPos = @NextPos

END

END

print 'ErrorId <>' + @QueryCondition

UPDATE [ESMS2_DBMS].[dbo].[ErrorDetails]

SET ErrorRectifyDateTime=GETDATE()

WHERE (NozzleId = @NozzleId) AND (ErrorRectifyDateTime IS NULL) AND (ErrorId <> @QueryCondition)

END

View 8 Replies View Related

Transact SQL :: Error Converting VARCHAR To BIGINT When Executing Query

Jun 4, 2015

DECLARE @i BIGINT
SET @i = 20150315
DECLARE @S VARCHAR(MAX)
SET @S = ''
SELECT @S = @S + '
DECLARE @Count BIGINT
SET @Count = '+@i+' + 1

SELECT @Count'
EXEC(@S)

I am trying to execute the above query but it is throwing me an error.

Msg 8114, Level 16, State 5, Line 6
Error converting data type varchar to bigint.

View 16 Replies View Related

Strange Problem: Error Converting Data Type Varchar To Bigint.

Nov 30, 2007



The strange in this problem is that i got this problem suddenly and before all was running without any error.

The script that cause the error is in the trigger for insertion on a table, there is somewhere where i convert from varchar to bigint, but all seems fine to me i printed the varchar variable and the conversion looks valid, also i included several print statement in the script for debugging purposes and i feel everything is right and there shouldn't be any error.

I don't think anything changed in my db, so i wonder where this problem is comming from ?
this is the code:



Code Block
-- Private Sending start
declare @tmpmsg nvarchar(200)
set @tmpmsg = ltrim(rtrim(@message)) -- Remove leading and trailing blanks
if (left(@tmpmsg,4))='خاص' and len(@tmpmsg)>6
begin
declare @msg_error nvarchar(70)
declare @msg_error1 nvarchar(70)
declare @msg_error2 nvarchar(70)
declare @msg_error3 nvarchar(70)
declare @sender_id bigint
set @msg_error1 = 'الرجاء إرسال كلمة خاص متبوعة برقم ملÙ? الشخص المطلوب ثم الرسالة الشخصية'
set @msg_error2 = 'الرجاء تسجيل ملÙ?Ùƒ قبل إستخدام خدمة الرسائل الخاصة'
set @msg_error3 = 'إن ملÙ? الشخص المطلوب غير موجود'
-- The message should not go to chat filtration
update received_in set sent = 3 where reqid = @id
-- if the sender profile doesn't exist, send him a message indicating that.
SELECT @sender_id = profile_id FROM profiles where msisdn=@msisdn
if @sender_id is not null
begin
set @tmpmsg = ltrim(right(@tmpmsg, len(@tmpmsg)-3))
-- Now the message looks like '12345 this is a test message'
declare @profileid bigint
declare @strprofileid nvarchar(50)

declare @posSpace int
set @posSpace = charindex(' ', @tmpmsg)

if @posSpace = 0 -- Not found (the message format is like this 'pri 3432434 ' or 'pri dfsdffsd '
begin
set @msg_error = @msg_error1
-- Insert the message into the filtration screen to be fixed by a filtrator, the recipient_id will be set to 0
insert into mobile_chat (sender_id, recipient_id, message, datein, timein)
Values (@sender_id, 0, @tmpmsg, @thedate, @thetime)
end
else
begin
set @strprofileid = left(@tmpmsg, @posSpace-1)
-- first char separating profileid and util message
if isnumeric(@strprofileid) = 1
begin
set @profileid = @strprofileid
declare @utilmsg nvarchar(200)
set @utilmsg = ltrim(right(@tmpmsg, len(@tmpmsg)-@posSpace))

-- Right message format
print 'Profile id=' + ltrim(str(@profileid))
print 'Message=' + @utilmsg
declare @recmsisdn varchar(16)
select @recmsisdn = msisdn From profiles where profile_id=@profileid
-- if the receiver profile doens't exist, send him a message indicating that
if @recmsisdn is not null
begin
-- All fine: msg format, sender and receiver
if left(@recmsisdn,3)='000'
Insert into Inbox (sender_id, recipient_id, message, datein, timein)
Values (@sender_id, @profileid, @utilmsg, @thedate, @thetime)
else
insert into mobile_chat (sender_id, recipient_id, message, datein, timein)
Values (@sender_id, @profileid, @utilmsg, @thedate, @thetime)
end
else
begin
-- Insert the message into the filtration screen to be fixed by a filtrator, the recipient_id will be set to 0
insert into mobile_chat (sender_id, recipient_id, message, datein, timein)
Values (@sender_id, 0, @tmpmsg, @thedate, @thetime)
set @msg_error = @msg_error3
end
end
else
begin
set @msg_error = @msg_error1
end
end
end
else
-- The sender profile is not registered with us
set @msg_error = @msg_error2
if @msg_error is not null
begin
print @msg_error
if left(@msisdn, 3) = '966' -- We can only send replies to KSA mobiles
INSERT INTO cgi_sms_services.dbo.cgi_sms_in(msisdn, sms_code, message, reqport, smstype)
VALUES (@msisdn, '1000000002', @msg_error, 86367, 'wcsms')
end
end -- Private Sending End

View 3 Replies View Related

To Bigint, Or Not To Bigint?

May 27, 2008

 Hey, quick question here. In my database for my webapp (The one I showed you guys in my previous post), in my stickies table, I am using a column called StickyId for the PK, and it is of type int. My concern is that eventually, I may get to a point with more then 2 million records in the stickies field. I am looking at using the bigint datatype for StickyId instead, but it takes up twice the memory. So I have two questions:1. Can I declare the StickyId column as type int for now, and if my DB ever starts approaching the 2 million mark, access my DB and change it over to a bigint type? Aka, will MS SQL convert the exisiting int values into a bigint and be transparent to the app and the users?2. Does the bigint always use 8 bytes to store its value? Aka does it pad, so that if I stored the value of '1' would that take the same space as if I stored the value '43563636'? Or is it more like varchar, only taking up the space that that particular value needs?Thanks in advance guys!

View 3 Replies View Related

Bigint

Mar 18, 2008

Hi there! My question is: I use a bigint data type as a primary key in my database, so
1. Can I define bigint autoincrement as unsigned?
2. In case of possible, what type should I use in C# code that equal to bigint unsigned - ulong?
3. In case of impossible, what type should I use in C# code - long?
Thanks

View 7 Replies View Related

Bigint Field Vs Int

Sep 23, 2007

i am creating an application which the number of records will be beyond 100000 so i need to set the primary keys to bigint instead of int
i need to know about the performance and difference
will it affect the performance much and second will i have to change any code like delete,update

View 3 Replies View Related

Convert INT To BIGINT

Apr 11, 2006

Hi guys

View 19 Replies View Related

Bigint Datatype

Mar 10, 2008

I am using bigint as a primary key. What happens when bigint reaches the maximum number that it can hold?

The Yak Village Idiot

View 8 Replies View Related

Bigint As Unsigned Value?

Oct 4, 2006

The documentation seems to suggest that I can store either a signed or unsigned value in bigint. If I want to store an unsigned value how do I go about it?

View 2 Replies View Related

Convert To BigInt

May 20, 2008



This select qry runs for abt 20 mins, I think convert to bigint is causing the slowness. Underlying tbl has abt 50000 recs. Pl note that I am runnign this in SQL SERVER 2005, Where it takes abt 20 mins. However when I run this on SQL Server 2000, it takes only 4 mins.


ANy ideas to speed up this qry.

select distinct convert(bigint,c.loannum) as loannum ,c.ampsstatus ,((convert(char(10),c.insdate,110) )) as MaxInsdate
from Conversion_AllStatus_History2007 c
where ((convert(char(10),c.insdate,110) )) =(select max((convert(char(10),a.insdate,110) )) from
Conversion_AllStatus_History2007 a
where convert(bigint,a.loannum)=convert(bigint,c.loannum))

View 3 Replies View Related

Problems Moving Data Over 8000k In DB2 Varchar Column Into SQL Server Varchar(max) Using SSIS

Nov 20, 2007



I have looked far and wide and have not found anything that works to allow me to resolve this issue.

I am moving data from DB2 using the MS OLEDB Provider for DB2. The OLEDB source sees the column of data as DT_TEXT. I setup a destination to SQL Server 2005 and everything looks good until I try and run the package.

I get the error:
[OLE DB Source [277]] Error: An OLE DB error has occurred. Error code: 0x80040E21. An OLE DB record is available. Source: "Microsoft DB2 OLE DB Provider" Hresult: 0x80040E21 Description: "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.".

[OLE DB Source [277]] Error: Failed to retrieve long data for column "LIST_DATA_RCVD".

[OLE DB Source [277]] Error: There was an error with output column "LIST_DATA_RCVD" (324) on output "OLE DB Source Output" (287). The column status returned was: "DBSTATUS_UNAVAILABLE".

[OLE DB Source [277]] Error: The "output column "LIST_DATA_RCVD" (324)" failed because error code 0xC0209071 occurred, and the error row disposition on "output column "LIST_DATA_RCVD" (324)" specifies failure on error. An error occurred on the specified object of the specified component.

[DTS.Pipeline] Error: The PrimeOutput method on component "OLE DB Source" (277) returned error code 0xC0209029. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.

Any suggestions on how I can get the large string data in the varchar column in DB2 into the varchar(max) column in SQL Server 2005?

View 10 Replies View Related

The Data Types Varchar And Varchar Are Incompatible In The Modulo Operator

Jan 4, 2008

I am trying to create a store procedure inside of SQL Management Studio console and I kept getting errors. Here's my store procedure.




Code Block
CREATE PROCEDURE [dbo].[sqlOutlookSearch]
-- Add the parameters for the stored procedure here
@OLIssueID int = NULL,
@searchString varchar(1000) = NULL
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
IF @OLIssueID <> 11111
SELECT * FROM [OLissue], [Outlook]
WHERE [OLissue].[issueID] = @OLIssueID AND [OLissue].[issueID] = [Outlook].[issueID] AND [Outlook].[contents] LIKE + ''%'' + @searchString + ''%''
ELSE
SELECT * FROM [Outlook]
WHERE [Outlook].[contents] LIKE + ''%'' + @searchString + ''%''
END




And the error I kept getting is:

Msg 402, Level 16, State 1, Procedure sqlOutlookSearch, Line 18

The data types varchar and varchar are incompatible in the modulo operator.

Msg 402, Level 16, State 1, Procedure sqlOutlookSearch, Line 21

The data types varchar and varchar are incompatible in the modulo operator.

Any help is appreciated.

View 5 Replies View Related

Bigint Type Primary Key

Jun 19, 2006

I'm using Sql Server 2000/7 for my projects.

How to handle the situation if a primary key (a field set as identity) of type bigint gives an overflow problem?

Is there any way to reuse identities if a primary key field is set as identity from the database settings? (we can do this if we donot set the primary key field as identity from the datbase and handle it from front end)

please help

View 1 Replies View Related

How To Convert Bigint To Timestamp

Mar 23, 2012

I am new SQL Server, I have below Timestamp conversion running in Oracle how do I convert same in SQL Server

Default date - 01/01/1970
Application stores Date as bigint - 1326310811062

(TIMESTAMP('01/01/1970', '00:00:00') + (1326310811062 / 1000) SECONDS) AS CREATION

View 7 Replies View Related

Bigint Autoincrement Question

Apr 15, 2004

Hi All,

i wonder if i can get an bigint autoincrement field where the number begins with the current year + 1 autonumber

Does someone know if it is possible and if yes, how?

Already thanx.
Cheers Wim

View 10 Replies View Related

SQL Server BIGINT And MS ACCESS...

Jul 23, 2005

I have an SQL back-end with and Access front end. A table in my SQL db hasan auto-num field (integer) that has exceded 70000+ entries. I can add nomore to this table unless I convert that field from INT to BIGINT. Ofcourse, Access doesn't seem to know what a BIGINT is... suggestions?

View 3 Replies View Related

Bigint And Int64 - When Fixed?

Nov 22, 2006

I am attempting to build our first set of packages populating or DW. All of our source system primary keys are bigints (on the main tables at least). SSIS seems to have a problem dealing with bigint values, i.e. having to assign variables as doubles rather than int64, having to cast returning bigint values as float, or bigint sproc output parameters as double. It is all a bit messy (and possibly the most frustrating part of SSIS for me) - does anyone know if this problem is due to be fixed in any forthcoming release?

View 2 Replies View Related

SSIS - Importing Varchar From Access Into SQL2005 As Varchar

Nov 20, 2006

For the life of me I cannot figure out why SSIS will not convert varchar data. instead of using the table to table method, I wrote a SQL query so that I could transform the datatype ntext to varchar 512 understanding that natively MS is going towards all Unicode applications.

The source fields from Access are int, int, int and varchar(512). The same is true of the destination within SQL Server 2005. the field 'Answer' is the varchar field in question....



I get the following error



Validating (Error)



Messages

Error 0xc02020f6: Data Flow Task: Column "Answer" cannot convert between unicode and non-unicode string data types.
(SQL Server Import and Export Wizard)


Error 0xc004706b: Data Flow Task: "component "Destination - Query" (28)" failed validation and returned validation status "VS_ISBROKEN".
(SQL Server Import and Export Wizard)


Error 0xc004700c: Data Flow Task: One or more component failed validation.
(SQL Server Import and Export Wizard)


Error 0xc0024107: Data Flow Task: There were errors during task validation.
(SQL Server Import and Export Wizard)


DTS used to be a very strong tool but a simple import such as this is causing me extreme grief and wondering of SQL2005 is ready for primetime. FYI SP1 is installed. I am running this from a workstation and not on the server if that makes a difference...

Any help would be appreciated.





View 7 Replies View Related

DTS Copy Truncates Bigint Values

Nov 24, 2003

I just discovered that a bigint column in one of my tables is getting it's values truncated when I run a DTS job to copy the data to another database. The DTS job is designed to refresh our test environments from our production database. All the other tables copy fine. This include another table that also contains a bigint column. But this one table consistenly has a problem where 60 or so records are translated from positive number to negative values. The only explaination I came up with was truncation at some point.

Anyone know of a way to fix or work around this?

View 3 Replies View Related

Datetime -&> Binary -&> Bigint (for Sorting)

Apr 20, 2007

this is more of a theoretical question and not necessarily for best practice...though if reliable and efficient, i'd use it.

a lot of my sprocs return xml and are then processed in xslt...so when i need to sort by date (in xslt), i pass the datetime to a function that ultimately returns a bigint...it seems to work, but i'm not 100% confident...

can anyone confirm that the resulting integer values can be relied on for sorting?


function return: cast((cast(@dt as binary(8))) as bigint)

small test:

sql Code:






Original
- sql Code




declare @i int, @d datetime
declare @t table (id int identity, dt datetime, bd binary(8), bi bigint)
set @i=1
set @d = getdate()
while @i between 1 and 20
begin
insert @t(dt, bd, bi)
select
@d,
cast(@d as binary(8)),
cast((cast(@d as binary(8))) as bigint)

set @d = dateadd(mi, @i, @d)
set @i=@i+1
end

select *
from @t
order by bi






DECLARE @i int, @d datetimeDECLARE @t TABLE (id int identity, dt datetime, bd BINARY(8), bi bigint) SET @i=1SET @d = getdate()WHILE @i BETWEEN 1 AND 20BEGIN    INSERT @t(dt, bd, bi)    SELECT         @d,         CAST(@d AS BINARY(8)),         CAST((CAST(@d AS BINARY(8))) AS bigint)     SET @d = dateadd(mi, @i, @d)    SET @i=@i+1END SELECT *FROM @tORDER BY bi

View 1 Replies View Related

Error When Updating Bigint Columns Using ADO

May 3, 2007

I am attempting to write a conversion of our product for Compact Edition; we already provide it based on SQL Server. The database interface uses ADO through a Python-win32com adaptor, and has worked fine so far. (Note: *not* ADO.net, just plain old COM)

Now, a curious thing happens. When inserting new data through a Recordset, everything works fine - except for columns defined as bigint. There are no exceptions thrown, but when you read the columns back they contain nothing but zeroes. Do the same to any other column type - I've tried integer, numeric, float, nvarchar and ntext so far, and they all seem to work just fine. It does not seem to be conversion-related either, since I've tested the exact same data to various column types. And using bigint on regular SQL Server works just fine.

The code involved is quite unspectacular, and simply switching the column types to integer would solve the immediate problem, but causes potential future issues since we normally store internal IDs in bigint columns, and the values may grow quite large.

View 1 Replies View Related

Variable That Maps To Bigint In SSIS

Sep 11, 2006

Hello

Which variable type in SSIS maps to bigint in SQL Server 2005?

I am returning a single column value of type bigint from SQL Server and want to store that in a varible in SSIS, what datatype should I use?

I tried Int32, Int64, Uint64 and it did not work. Did I do something wrong?

Thanks





View 1 Replies View Related

DB Engine :: Int -> Bigint And Resource Allocations

Jun 8, 2015

I've got a problem: in few months from now my IDs (int) will reach max positive value. The only viable solution is to convert int-s to bigint-s.

There is a story behind this but I believe it's irrelevant. Simply, I need to 'upgrade' int-s to bigint-s; let's take it as a fact.

Question is: is there a formula to calculate increase in disk and RAM consumption? If we presume I'd need to have same number of pages in buffer cache, how can I calculate how much more memory I need?

Just to ease calculation, let's suppose that I have single table with 1e6 rows and 3 columns:

ID (int), PARENT_ID (int) and NAME (NVARCHAR(30)). 

PK is on ID (let's call it PK_ID) and there are 2 indexes on PARENT_ID (i.e. IX_PARENT) and NAME (IX_NAME).

Now, if I turn int-s into bigint-s and still want to keep entire table in cache, how I can calculate how much memory I'd need?

View 5 Replies View Related

Unexpected BIGINT Conversion Behavior

Jun 11, 2007



I've recently been struggling with moving a bigint data result from a query into an SSIS variable through the Execute SQL Task. Now, I could just be doing this incorrectly, but I couldn't get it to work at all if I made the variable int64 in SSIS. So here's what I found:



1. bigint from the query into int64 SSIS variable doesn't work at all. It fails.

2. bigint from the query into string SSIS variable works. BUT, it truncates it. And it's a crazy result, at least to me. All of a sudden the number 840550000000000 becomes 8405500000. Now, that's a really unexpected result to me. It seems to me this is a pretty crazy result.

3. Now, if I cast the bigint to varchar in the query and put it into a string SSIS variable, it works perfectly.



Is this a bug? If not, how is this expected behavior? Or maybe I'm just nuts after hours of futzing with this.



Thanks,

Michael

View 14 Replies View Related

Convert Or Cast HexaDecimal To Bigint

Aug 21, 2006

Hi ,

I have a hexadecimal string value. I want to convert it to Bigint in Sql Server 2005.

The Hexadecimal value is '0x000000000000000F'.

How is it possible to convert into Bigint.

Please help me

Thanks in advance

Srinivas





View 6 Replies View Related

Return BIGINT OUTPUT Param To VB!?

May 9, 2006

Please help me on this one.

I need to return a value to VB.
I've tried returning a numeric value NUMERIC(25,20) via an output parameter but this didn't work. I'm know at a point in wich I created a bigint and multiplied the value so that the decimals are gone. However it only returns NULL?!?!?!?!!?!?
Here's part of my stored proc

CREATE PROCEDURE dbo.uspCalcWeightedAverage @StartDate2 varchar(10), @EndDate2 varchar(10), @InMarket nvarchar(50), @InProductType int, @InWeekDay int, @WeightedAverage bigint OUTPUTAS......SELECT @WeightedAverage = cast(10000000000 * (SUM(HHF.FACTOR) / COUNT(PDF.FLAG)) as bigint)FROM TBL_PRODUCTDEFS PDF INNER JOIN #DATESBETWEENINTERVAL DBI ON DATEPART(HH, [DBI].[DATE]) = [PDF].[HOUR] INNER JOIN tbl_historichourlyfactors HHF ON DATEPART(D,DBI.DATE) = HHF.DayID AND [PDF].[HOUR] = [HHF].[HOUR] AND DATEPART(M,DBI.DATE) = [HHF].[Month]WHERE PDF.MARKETID = @InMarketID AND PDF.PRODUCTTYPEID = @InProductTypeID AND [PDF].[WD-WE] = @InWeekDay AND HHF.MARKETID = @InMarketID AND PDF.FLAG = 1GROUP BY FLAG

When I retrieve the output param it returns a NULL value. the properties in VB say that the parameter has the following props:
attribute 64 (Long)
NumericScale 0 (Byte)
Precision 19 (Byte)
Size 0 (ADO_LNGPTR)
Type adBigInt
Value Null

I try to return it with the following code (got the code from a friend)

Public Function RunProcedure(ByVal v_strStoredProcName As String, ByRef r_varParamValues() As Variant) As ADODB.RecordsetDim objAdoRecordset As ADODB.RecordsetDim objAdoCommand As ADODB.CommandDim lngCtr As Long On Error GoTo RunCommand_Error ' Create cmd object Set objAdoCommand = New ADODB.Command Set objAdoCommand.ActiveConnection = m_oAdoConnection objAdoCommand.ActiveConnection = m_oAdoConnection objAdoCommand.CommandText = v_strStoredProcName objAdoCommand.CommandType = adCmdStoredProc Call objAdoCommand.Parameters.Refresh 'Stop For lngCtr = 0 To UBound(r_varParamValues) If objAdoCommand.Parameters(lngCtr + 1).Direction = adParamInput Then objAdoCommand.Parameters(lngCtr + 1).Value = r_varParamValues(lngCtr) End If Next Set objAdoRecordset = New ADODB.Recordset objAdoRecordset.CursorLocation = adUseClient Set objAdoRecordset = objAdoCommand.Execute 'Stop For lngCtr = 0 To objAdoCommand.Parameters.Count - 1 If objAdoCommand.Parameters(lngCtr).Direction = adParamOutput Or objAdoCommand.Parameters(lngCtr).Direction = adParamInputOutput Then r_varParamValues(lngCtr - 1) = objAdoCommand.Parameters(lngCtr).Value End If Next Set RunProcedure = objAdoRecordsetRunCommand_Exit: ' Collect your garbage here Exit FunctionRunCommand_Error: ' Collect your garbage here Call g_oGenErr.Throw("WeatherFcst.CDbsConn", "RunCommand")End Function


PLEASE HELP.

Regards,

Sander

View 1 Replies View Related

Retrieving The BigInt Value From The Identity Column After Inserting

Jul 26, 2007

I have a database that has a tble with a field that autoincrements as a primary key. meanig that the field type is BigInteger and it is set up as my Identity Column. Now when I insert a new record that field gets updated automaticly.
How can I get this value in the same operation as my insert? meaning, in 1 sub, I insert a new record but then need to retieve the Identity Value. All in the same procedure. 
Waht is the way to achive this please?
Marc

View 2 Replies View Related

Core Data Type Question (bigint)

May 10, 2005

We are trying to work with our developers to upgrade to SQL 2000 from SQL 7 for a critical applicaion and all looks good in testing for the most part.  The concern that our developers have is that in order for the application to work on the test SQL 2000 server they had to delete a core data type (bigint) for the application to work.  It doesn't appear to have any negative affects and we know for sure that the application database does not need that data type at all. 
Can someone verify that there are no requirements for SQL 2000 needing to have this data type?   They are worried that something within SQL may rely on it and we would find out the hard way in production possibly.
 
 

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved