Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««1234»»»

convert DateTime to BigInt Expand / Collapse
Author
Message
Posted Tuesday, January 20, 2009 4:42 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, November 3, 2009 5:24 AM
Points: 10, Visits: 18
not lik tht,
values entered in these column was datetime only but in future i need to make entries
only as bigint
Post #639799
Posted Tuesday, January 20, 2009 4:50 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 9:41 AM
Points: 6,789, Visits: 14,000
munishprathap (1/20/2009)
not lik tht,
values entered in these column was datetime only but in future i need to make entries
only as bigint


How many rows are currently affected?


“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Exploring Recursive CTEs by Example Dwain Camps
Post #639801
Posted Tuesday, January 20, 2009 4:55 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, November 3, 2009 5:24 AM
Points: 10, Visits: 18
we cant predict no. of rows affected assume tht tables have 10 rows
Post #639807
Posted Tuesday, January 20, 2009 4:57 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 9:41 AM
Points: 6,789, Visits: 14,000
munishprathap (1/20/2009)
we cant predict no. of rows affected assume tht tables have 10 rows


How many rows do you have in the table right now?


“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Exploring Recursive CTEs by Example Dwain Camps
Post #639810
Posted Tuesday, January 20, 2009 5:00 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, November 3, 2009 5:24 AM
Points: 10, Visits: 18
Ok thts great
its having 10 rows and one column have DateTime type with values.
Post #639812
Posted Tuesday, January 20, 2009 5:12 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, May 30, 2014 6:27 PM
Points: 2,808, Visits: 7,175
munishprathap (1/20/2009)
Ok thts great
its having 10 rows and one column have DateTime type with values.


Do these date-time values mean anything? what are your rules for converting a date to integer while still keeping the same value as you will not be able to put a datetime into an int column..
Post #639817
Posted Tuesday, January 20, 2009 5:19 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 1:53 PM
Points: 35,366, Visits: 31,905
munishprathap (1/19/2009)
Thanks Jeff
according to my requirement i need to keep the one column type as bigint but unfortunately
i keep it as DateTime after long time i found that it was DateTime Type. so i need to write
a Script / Query which updates the Column field type as BigInt from DateTime and set the ID Column as
Identity with primary key.

My Table Script

CREATE TABLE [dbo].Number (
[ID] [BIGINT] NOT NULL,
[LastModifyBy] [DATETIME] NOT NULL)


Please stop and think a minute and I'll give you the answer. What is the purpose of storing a DateTime as a BigInt? I need to know the real reason... not that it's simply a requirement you've been given.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #639818
Posted Tuesday, January 20, 2009 5:20 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 9:41 AM
Points: 6,789, Visits: 14,000
munishprathap (1/20/2009)
Ok thts great
its having 10 rows and one column have DateTime type with values.


Is this table heavily used at present?


“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Exploring Recursive CTEs by Example Dwain Camps
Post #639820
Posted Tuesday, January 20, 2009 5:20 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, November 3, 2009 5:24 AM
Points: 10, Visits: 18
No
Post #639821
Posted Tuesday, January 20, 2009 5:25 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 9:41 AM
Points: 6,789, Visits: 14,000
munishprathap (1/20/2009)
No


If no other students are using it, why don't you simply script a new table using EM and copy the data into it?


“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Exploring Recursive CTEs by Example Dwain Camps
Post #639824
« Prev Topic | Next Topic »

Add to briefcase ««1234»»»

Permissions Expand / Collapse