SQL 2012 :: Datetime To Date Datatype Increasing Index Size?
Mar 6, 2014
I have a database which is centered around two date tables (approx. 5.5 million records each). We are finally making the big leap from SQL Server 2005 to 2012. The data is currently stored as datetime, and we are hoping to take advantage of the new date datatype, since the time component is not needed.
The first table has 13 different date columns. In testing on the 2012 server I have changed 3 columns so far, and have seen that changing the datatype to date is actually increasing the Index size and not affecting the data size. Only 3 of the columns are associated with indexes, and modifying a non-indexed column still increased the index size. I am running the Disk Usage by Table report to view the sizes.
View 3 Replies
ADVERTISEMENT
Jan 16, 2015
I have below SQL, which should be order by posteddate ASC
SELECT AnnouncementID,[Subject],[Description],
CONVERT(nvarchar(10),PostedDate,101) AS PostedDate,
CONVERT(nvarchar(10),ExpiredDate,101) AS ExpiredDate,
CountryID,CreatedBy, CreatedDate, ModifiedBy, ModifiedDate
FROM Announcements a
WHERE isActive = 1
AND CountryID = 2
AND (GETDATE()>= PostedDate)
AND (GETDATE()<= ExpiredDate)
ORDER BY PostedDate ASC
But result is displaying as below, PostedDate datatype is datetime
01/01/2015
01/02/2015
12/28/2014
12/31/2014
Expected result is
01/02/2015
01/01/2015
12/31/2014
12/28/2014
View 1 Replies
View Related
Apr 19, 2006
For some reason, I recall having read that SQL Server 2005 would supporta datatype that represented date, but not time. (This would be usefulfor storing things like birthday, where you usually don't care about thetime of day). But I've got SQL Server 2005 installed, and there's nosuch datatype to be found.Is this something that might be released in a Service Pack, or is itjust not going to happen?
View 3 Replies
View Related
Apr 26, 2006
I have a column with DateTime Datatype. But I want to display just Date , not time.
Like 4/26/2006 not 4/26/2006 9:25:55AM
pls help
View 3 Replies
View Related
Jul 13, 2000
Hi,
I have a requirement to be able to select and group records by the date portion of a datetime field. ie ignore the time when grouping so that all records lodged on a particular day are seen together.
I have been able to do this by
- converting the datetime data to the number of days since a given date
- inserting this into a temporary table
- retrieving the the data from the temporary table
- convert the data back to a date using DATEPART to display dd/mm/yy
This then gives me the data grouped as required but seems to be a very difficult solution - Is there an easier way??
Thanks in advance
jan
View 3 Replies
View Related
Jan 18, 2014
I have a table where the Primary Key is of datatype DATE. This column is also a clustered index. Since not every day is in this column i am looking for a way to address a date one ( or two, or three) Dates before a given date. Something like:
select * from myTable
where [date] = one record previous to record where date = '22-05-2000'
How is that possible.
View 1 Replies
View Related
Feb 15, 2006
Hi,
We are migrating our database from DB2 8 to SQL Server 2005. We have date and time saperate columns in DB2. For example, Date_of_birth, Store_sun_open_time, Store_sun_close_time etc. For date we are using datetime. For time what datatype should we use in SQL Server?
Thanks
Prashant
View 3 Replies
View Related
Apr 12, 2007
Need some quick help here.. The data I got from the text file use the "04/11/2007" date format and the StockDate in MS-SQL use the datetime datatype.
My understanding is that the "04/11/2007" will default to the 04/11/2007 12:00 am" format in MS-SQL.
So, when I use the sql query, how do search only for the date part of the data in MS-SQL and match it to the data from text file? I tried this SQL Query below.
--snip--
SELECT RawID FROM tblPurchaseRaw WHERE VIN = '" & sVin.ToString.Trim & "' AND StockDate = '" & dStockDate.ToString.Trim & "'
--snip--
That way, if I get a row then I know the data is there. If I don't get a row then I know the data is not there.
Bold: I get it now. It is all automatic as MS-SQL does it automatically...
View 5 Replies
View Related
Feb 25, 2000
Hello all,
Can I know somedetail about why the Sqlservr.exe app increasing in size drastically. Even I check all parameter of the server and I check the process running on server.
I feel server is not releasing the queues and It is occupying the memory. I any one suggest what could be the cause ?
Thanks,
View 1 Replies
View Related
May 12, 2000
Hello,
Does anyone know of a good process to increase a Column size of type char, that already had data in it, without losing the data you already have?
Thanks,
Kevin
View 1 Replies
View Related
Dec 6, 1999
I am having trouble increasing the size of the log device on a SQL 6.5 database. When I use SQL Enterprise Manager I get an error saying that the device has 0 MBs available. When I use the ALTER DB statement I get an error saying that there is not enough space on the disk, but I know this not to be the case. Has anyone any suggestions?
Thanks in advance,
Michael lawlor
View 4 Replies
View Related
Jun 18, 2008
Hello, relatively new to SQL Server.
I have a database with 1 .mdf data file and 1 .ldf t-log file. There are multiple inserts/deletes/transactions performed on the data daily, but the size of the two files remains constant (5,774,,336 and 153,480 respectively)??? I perform daily full backups and hourly T-log backups (during business hours of 9-6) and these backup files change size, but why aren't my physical DB files changing? I have them set to auto-grow at 10% unrestricted...
Thanks for your help/advice
Arthur
View 9 Replies
View Related
Feb 11, 2008
Hi all
I have a Publisher,distributor and subscriber in the same server
The distribution database size has increased upto 30GB (.mdf file)
what are the reasons that .mdf file would incease to such extent.
we do some data migration to tables which are replicated
is there a way we can reduce the distribution.mdf size?
Thanks
View 1 Replies
View Related
Jul 15, 2002
Is there a way to increase the size of the procedure cache. Or is it only a auto configuring option.
I have 2gb of memory, and when I check the size of the procedure cache it is just 10mb. I would like to increase this to around 50mb. Not sure if there is an setting to do this. Had a look on BOL could not find anything.
thanks
Jane
View 1 Replies
View Related
Jul 20, 2005
Just wondering if you could help me on this one. I'm not sure if mytransaction logs are behaving oddly or what. I've successfuly managedto shrink my transaction logs from 7GB down to 1MB and now I find itstrange that the log file doesn't seem to increase its size. Thetimestamp of the logfile is updating as well. But the size of the fileis constant. I haven't configured my database to do auto-shrink so Imreally confused why it hasn't changed its size for more than a monthnow.Hope I'm not losing any data here.Kindly advise.
View 7 Replies
View Related
Apr 30, 2008
i have a very big database and number of people are working on it.. it's log file size is increaseing very day too much.. i am taking log back every 30mint...
i dont' know that wethare i need to truncate the log file after taking the log file backup or not.. i am taking differentail backup every day and full backup every week...
Please tell me do i need to trucate the log file to reduce the file size or i hv to leave as it....
Thanks..
View 26 Replies
View Related
Jan 4, 2005
Thanks to all participants.
I am using SQL Server 2000 with replication object for two location. Log size on publisher go upto 25 times of data file size, I mean 80 MB Data files has maintains 2 GB log file and it is same for all five co's working on same windows 2000 advanced server board.
Since last week server randamly get disconnected from user applications and at that time few tables are not openable at server.
Can any one give a reason ? Why this type misbehaviou done by SQL Server 2000?
Thanks.
View 11 Replies
View Related
Mar 4, 2005
Hi to all,
I am using a connection string like
data source=RemoteHostName;initial catalog=myDb;password=sa;user id=sa;
Max pool size = 200;
And now strange thing is happening ,, I am receiving error :
Timeout expired. The timeout period elapsed prior to obtaining a connection
from the pool. This may have occurred because all pooled connections were in
use and max pool size was reached
The SqlServer Activity Manager is telling that only 100 connections are pooled, and I guess that the Max pool size is 100, It is not being changed by my Connection string. As I am trying to change the default 100 pool size value to 200.
Huh , So stucked up , how to increase the Max pool size.. Is there any way .
I am getting worrried.
Any help ??
Thx and Regards
View 1 Replies
View Related
Sep 17, 2003
Database is SQL Server 2000
I have a field in a table that stores date of birth. The field's datatype is char(6) and looks like this: 091703 (mmddyy). I want to convert this value to a datetime datatype.
What is the syntax to convert char(6) to datetime?
Thank you in advance.
View 1 Replies
View Related
May 19, 2014
What would be the most economy solution for this WHERE, I see the code where we have covnert to 101 type on both sides of equation, which I tnink is not right.
So I'm thinking to put it on the left like this, just curiouse is this the best solution, I also heard that TSQL interpret between even better , here I'm really care abour performance.
declare @DATE DATE = '01/14/2014'
--A:
SELECT * FROM TT
WHERE CAST( TT.DATETIME AS DATE) = @DATE
--B:
SELECT * FROM TT
WHERE TT.DATETIME >= @DATE and TT.DATETIME < DATEADD(D,1,@DATE)
View 3 Replies
View Related
Dec 7, 2014
I have define two variable of Datetime type @Sdate and @Edate.
1. @Sdate = DATEADD ("DD", -5, GETDATE())
2. @Edate = GETDATE()
3. Using Forloopcontainer for pulling the data into batches
( @sdate = dateadd ( "HH" , 1, @sdate))
Now since i am using getdate() to define @Sdate. my variable gets data as ( 2014/12/08 11:43:00AM)
Converting GETDATE( 2014/12/08 11:43:00AM) to only date 2014/12/08 00:00:00AM.
I tired using DT_WSTR which works fine (converting datetime int String).
Problem occurs when i am going through For Loop container . Since i have used assignment of @Sdate is says its not allowed.
View 9 Replies
View Related
Mar 27, 2014
I need to find all the index and the creation date. I did cross apply of sys.objects & Sys.indexes on name column. I am getting some but the team is saying they created so many. Any other option to find Indexes and their creation date?
View 2 Replies
View Related
Jan 22, 2006
Keep getting this error when positioning to the last page of a report.
Using Server 2003...SqlRpt Svcs 2000 sp2
Detail error msg:
Exception of type Microsoft.ReportingServices.ReportRendering.ReportRenderingException was thrown. (rrRenderingError) Get Online Help
Exception of type Microsoft.ReportingServices.ReportRendering.ReportRenderingException was thrown.
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
Anyone have any suggestions? Any way to find out what collection is blowing?...or where parameter name: index comes from?
View 47 Replies
View Related
Jul 15, 2006
Dear
I am using varchar data type in my table.it provides maximum 8000 character. but i want more than that.
how to increase size more than 8000
i want to use text datatype but when i type in length it doenst type.it displays only 16.i cant change to another value.
please help me out
Waiting for reply
Regards,
ASIF
View 1 Replies
View Related
Aug 22, 2005
Hi all.
I'm using foxpro and I'm completely new to SQL. I'm trying to create a database into which I need to enter a time field. I've read around on the net that the only way to do this is using a datetime datatype but I can't find anywhere that explains the format I use to INSERT INTO my tables.
Anyone help?
*EDIT* I actually just want to enter the time and not the date and the time, I have read it is possible to do this using a convert but I'm happy enough to have the date and the time as I don't want to overcomplicate anything at this stage.
View 7 Replies
View Related
May 27, 2007
i've used datetime to store my date and when i read from the database, it displays 12:00:00am as well!..is there any datatype i can use?
View 9 Replies
View Related
Sep 21, 2006
HiI am using SQL 2005, VB 2005I am trying to insert a record using parameters using the following code as per MotLey suggestion and it works finestring insertSQL; insertSQL = "INSERT INTO Issue(ProjectID, TypeofEntryID, PriorityID ,Title, Area) VALUES (@ProjectID, @TypeofEntryID, @PriorityID ,@Title, @Area)"; cmdInsert SqlCommand; cmdInsert=new SqlCommand(insertSQL,conn); cmdInsert.Parameters.Add("@ProjectID",SqlDbType.Varchar).Value=ProjectID.Text; My query is how to detail with dates my previous code wasinsertSQL += "convert(datetime,'" + DateTime.Now.ToString("dd/MM/yy") + "',3), '";I tried the code below but the record doesn't save?string date = DateTime.Now.ToString("dd/MM/yy"); insertSQL = "INSERT INTO WorkFlow(IssueID, TaskID, TaskDone, Date ,StaffID) VALUES (@IDIssue, @IDTask, @TaskDone, convert(DateTime,@Date,3),@IDStaff)"; cmdInsert.Parameters.Add("IDIssue", SqlDbType.Int).Value = IDIssue.ToString();cmdInsert.Parameters.Add("IDTask",SqlDbType.Int).Value = IDTask.Text;cmdInsert.Parameters.Add("TaskDone",SqlDbType.VarChar).Value = TaskDoneTxtbox.Text;cmdInsert.Parameters.Add("Date",SqlDbType.DateTime).Value = date;cmdInsert.Parameters.Add("IDStaff",SqlDbType.Int).Value = IDStaff.Text;Could someone point to me in the right direction?Thanks in advance
View 3 Replies
View Related
Jan 21, 2007
hi ,How can I find sql Datatype (like NVARCHAR , DESIMAL & .. ) and size of columns and also is it Identity or not in a Table of SQl server?
View 4 Replies
View Related
Nov 3, 2004
Is there any method to find out the size of an image datatype currently in the database. For example I have 2 tables that contain the same image, but the archive table is not displaying the same as the main. I am thinking the image file was corrupted somehow but don't know how to check this out.
Any ideas?
View 1 Replies
View Related
Aug 10, 2007
Are we allowed to do a LIKE datetime in SQL queries?
The records data looks like so:
9/21/2000 10:30:40 AM
But I want to see model requests by an entire day ala:
Select * From ModelRequests Where RequestDateTime Like '9/21/2000%'
But I do know get any records returned.
What is the special way of dealing with the datetime datatype for these purposes?
View 13 Replies
View Related
Dec 3, 2001
Hello!
Here's the puzzle I'm trying to solve.
I have 2 columns (CreatedDate and StatusDate) in the table both of datetime datatype.
When I run query
select * from sale
where Statusadate = "11/30/2001" it returns rows back.
When I do the same but for CreatedDate column
select * from sale
where CreatedDate="11/30/2001" it returns zero rows back even if there are CreatedDates = "11/30/2001".
I don't understand why it works for one column and doesn't work for another one.
The example of CreatedDate value is "2001-11-30 10:10:33.000"
Thank you,
Lena
View 3 Replies
View Related
Sep 4, 2007
Hi Guys
Say i have a column name dtime asn datatype as datetime in databse. (MS SQL 2003). and allow null box is checked.
My problem is that when is insert a blank value for dtime ( / / ) it takes it. but when i insert (just nothing) it give me an error. I don't want to insert "null" in it. I there a way were i can leave these column as blank instead inserting a null.
Thanks
When is select datatype as datetime for a column
View 4 Replies
View Related
Jan 5, 2006
hi everybody,
i'm trying to calculate the 'SUM' of time spent in hrs. n min. How can i do this using SQL Server?
What i mean is, i've a column 'TIME_SPENT' that has 'datetime' datatype. This column saves time spent for an activity in format 'hh:mm'. Suppose a user spends 45min for activity 'A' and say 1hr 25 min for activity 'B' then i want to calculate the 'SUM' of 'TIME_SPENT' for the user which should appear as 'Total time spent =2:10'
Can somebody pls help me with this?
Thnx in advance.
View 5 Replies
View Related