.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

trouble getting dates right when importing Access table

Posted By:      Posted Date: September 13, 2010    Points: 0   Category :ASP.Net
I was given a bunch of data in Access and am putting it in SQL 2005 for an ASP.NET web app. Tryingto do a query to select only records where the current date is after the "postDate" field and on or before the "expireDate" field. WHERE (postDate <= CURRENT_TIMESTAMP) AND (expireDate >= CURRENT_TIMESTAMP) I'm getting no records returned even though there are some records that qualify. Tried using CURDATE() and NOW(), no difference. At this point I think it may be because the dates are not in the correct format. The columns were originally "Date/Time" format in Access and when I imported them into SQL using the DTSWizard, the datatype for those columns became "smalldatetime." Dates are in the format M/DD/YYYY HH:MM:SS. I'm guessing the query won't work because SQL is expecting YYYY-MM-DD. How do I fix this? Been spending a depressing amount of time running in circles with this.

View Complete Post

More Related Resource Links

importing table with Access "memo" field to SQL

I imported an access database using the DTS wizard, into SQL 2005. There is a field in one of the Access tables that is a memo field, filled with a bunch of text including linebreaks. After importing, the field is indicated as the nvarchar(MAX) datatype when I check in SQL Enterprise Manager. The text in that field is displayed without line breaks, both in EM and when viewed on a web page. I changed the datatype of that column to "text" and now can see line breaks when I hover over a value in that column while viewing the table data in Visual Studio 2010's Server Explorer.But when I display the data in a ListView, there are no linebreaks. When I view my TableAdapter in my dataset, there are no linebreaks either.I must be missing something here? Thanks. 

Data Points: Deny Table Access to the Entity Framework Without Causing a Mutiny


Julie Lerman shows database administrators how to limit access to databases from the Entity Framework by allowing it to work only with views and stored procedures instead of tables-without impacting application code or alienating developers.

Julie Lerman

MSDN Magazine August 2010

Under the Table: How Data Access Code Affects Database Performance


In this article, the author delves into some commonly used ways of writing data access code and looks at the effect they can have on performance.

Bob Beauchemin

MSDN Magazine August 2009

Why my BDC is not importing new profiles from DB table?

I have 72000 profiles records in SSP profiles database. I connected this BDC with SQL table. SQL table has 81000 records. When I do full Import it is importing only 72000 records only, not complete 81000 records. How to get them into SSP?

How to access the refrenced table fields in Ilist object of table MVC asp.net



I have 2 tables, master, detail. 1.master table have fields (id, username, plan)-->id is primary key (PK) 2. detail table have fields (srNo,id, worksummary, ... )--> srNo is PK.

I have created foreign key relationship from detail to .master table for "id" field.

the code is:

IList<detail> objDetail=new List<detail> (); 
IList<master> objMaster = new List<master> ();
string[] sarray = queryFields.Split('|');//

for (int i = 0; i < sarray.Length; i++)
string[] sfields = sarray[i].Split(',');

if (sfields[0] != "")

objDetail.Add(new _detail { Id = count , modify = sfields[1].ToString(), verified = sfields[2], I});


I have problem to add fields in "objDetail" using Add method. But I am unable to access the reference field "Id" , rest of the field of detail table can be accessed using objDetail.

How can I access the "Id" field from objDetail object to add in IList.

I want to solve this problem

InfoPath and Access - two parent tables and one child table


Hi there,

I'm trying to link an InfoPath form to an Access database, I want to connect the InfoPath form to 3 tables in the Access database but InfoPath will only recognise parent-child relationships in a series (e.g. the "Company" table is the parent to the "Customer" table, which is again parent to the "Orders" table)

I need to have two parent tables and one child table, though (e.g. "Customer" is parent to "Orders", but "Inventory_Item" is also parent to "Orders"). Is there any way to establish this in InfoPath? I'm using Windows XP, InfoPath 2007 and Access 2007.

Cheers, Patrick

Importing Access 2010 tables to SQL Server 2008 R2

I'm trying to import a series of Access 2010 tables to Sql Server 2008 R2.  The Access import drivers are for *.mdb (which if I recall was the file extension for Access when I was a kid, and don't recognize the .accdb file extention).  Similarly, the Excel driver is for Excel 2003.  Isn't there a driver and method to import directly to SQL 2008 from Access 2010? SQL is installed on my server, but Access is not installed on the server.  When I copy the file onto the server and try and open it directly into SQL, I get a 'no editor installed' error. I can't get the 'upsize' wizard to work becuase it won't open the connection to SQL, even though I enter the userid and password of the SQL DB owner.  I get the following error: ===================================================== Connection failed: ============================================================= I have to say I'm stumped.  The rest of the Office 2010 suite works really well together - perhaps I'm missing something very simple? Thanks!     I guess I could export my tables as Excel 2003 and then import them using Integration Services, or install SQL Express on my laptop and 'upsize' to that instance, but SQL State: ‘0100’ SQL Server Error: 11004 [Microsoft][ODBC SQL Server Dirver][TCP/IP Sockets]ConnectionOpen (Connect()). Connection failed: SQL

Trouble importing strange column format report from Excel 2007 to SQL 08

Hi, I'm not sure whether this belongs in this section or the SSIS one so hopefully I've got it right!  Hoping someone will be able to help with a problem I'm having importing a report with header and detail rows from our antiquated POS system into SQL 2008 tables.  The reports export in Excel 2007 format and for each header row there can be one or more detail rows starting from column B.  As such I've tried several things such as openrowset, an Access 12.0 OLE DB source in SSIS and even COM automation of Excel to try and write a conditional split which will hold the header details in variables then write them to rows alongside the detail rows.  I've pasted a small sample of the data here as I wasn't able to attach it: 01/07/2010 @ 11:18 Page: 1 RECEIVING: Voucher Journal Sort: VC|Str|Vou Date|Vou #|Document SID Filter: Voucher Date: 01/06/2010@12:00a..30/06/2010@11:59p Include Item detail: DCS|Item#|Desc1|Attr|Material|Size|Qty VC Str Vou Date Vou # Qty ABC 001 15/06/2010 12345 38 E NN 66 200148 XXXXXXXX RED SHAD E NN 66 200149 YYYYYYYYY BLACK GO E PP 60 200154 ZZZZZZZZZ BLACK CDE 002 16/06/2010 13839 8 F SA 35 217500 XXXXXXXX Natural F SA FL 218674 YYYYYYYYY Chalk F SA WE 221462 ZZZZZZZZZ White FGH 001 21/06/2010 13905 3 F SH 85 126260 XXXXXXXX Navy IJK 001 23/06/2010 13914 3 E AA 61 250005 YYYYYY

how to load dates in a table in a range

Hi i have a table DATEDESC with columns [FullDate] [DateName] [YearName] [MonthName] [DayOfTheWeek] [YearNumber] [MonthNumber] [WeekNumber] [DayNumber] SAMPLE DATA OUTPUT FULL_DATE DATE YEARNAME MONTH_NAME DAY_NAME YEAR MONTH_NUMBER WEEK_WITHIN_THE_MONTH WEEK_WITHIN_THE_YEAR DAY_NUMBER 2010-09-09 24:31.9 2010-09-09 NOT LEAP YEAR September Thursday 2010 9 2 37 9   I need to load a series of dates into this tale by giving a start and and end dates range. Lets say i need to load 10yrs of date's data into this column, i need to load all the dates into this table and get those respective column. The query i had to populate the sample data was with the current date. But i am not sure how to do this for a bunch of data when it is in a range. SELECT GETDATE() AS FULL_DATE, Convert(varchar(10), getdate(),110) as DATE_NAME, CASE (YEAR(GETDATE()))%4 WHEN 0 THEN 'LEAP YEAR'ELSE 'NOT LEAP YEAR' END AS [YEAR_NAME], DATENAME(MONTH,GETDATE()) AS [MONTH_NAME], DATENAME("DW",GETDATE()) AS [DAY_OF_THE_WEEK], DATENAME(YEAR,GETDATE()) AS [YEAR_NUMBER], MONTH(GETDATE()) AS MONTH_NUMBER, DATEPART(DAY,GETDATE() -1)/7+1 AS [WEEK_WITHIN_MONTH], DATENAME("WEEK",GETDATE()) AS [WEEK_WITHIN_YEAR], DAY(GETDATE()) AS  DAY_NUMBER So, could you please help me in build this query. Thank you.

Change to AD username causes trouble for external access to WSS 3.0

I have one WSS 3.0 site hosted on a standalone server. I have extended the site into an external zone that authenticates with Digest authentication. This has been working fine for the past year or so. We have been looking into changing the user account naming scheme for Active Directory, and have been testing the change out on my own account. In doing so, I am still able to access our Sharepoint site from the Intranet zone on our internal network, but not from the external web address. I have tried removing my account from the site collection, and even going into the WSS_Content.AllUserData SQL table and changing the account name from DOMAIN\OldUserName to DOMAIN\NewUserName. No matter what I have tried, I get "HTTP Error 401.1 - Unauthorized: Access is denied due to invalid credentials. Internet Information Services (IIS)" when I try to log in with any username.   Help?

Help in Building Fiscal Dates Table

hi Experts,  I'm trying to build fiscal periods table. I have Calendar Dates of year 2007  in 1 table and just start Dates of Fiscal weeks in another table, can any one suggest me about building Fiscal table containing entire year using the 2 tables.  thank you ....   

how to search between 2 dates and times in access ?

hi i have in my access fields `MyDate` and `myTime`. MyDate in format: `16/09/2010 00:00:00` MyTime in format: `16/09/2010 04:27:00` i need to search between `date 01/01/2010 and time 12:50:00  - and - date 12/11/2010 time 01:34:00` which  query i need to write  ? thank's in advance

Creating Table of consecutive dates


I'm trying to create a table with one field (SmallDate&Time)

I want this table to have consecutive dates beginning roughly 01/01/2008

through 12/31/2013.

I think I need a Stored procedure to do this but am not sure.

It may even be doable from an SQL Query.

Any help would be appreciated.









Trouble Using More Than One LIKE Operator in a Table Filter in SSRS 2008


Hello All,

I'm having what I'm hoping will be a simple issue -

My co-worker has created a large report which contains several tables in SSRS 2008.  Each table is tied to one dataset, yet only certain data can be returned to each respective table.  Right now he's applying filters at the table-level behind each table, however as you can imagine this is not efficient because there is a LOT of data returning for this report. 

I'll try and give a simplified example -

There are two tables in the report body - one for containing products relating to both Cats and Dogs, and one for containing products relating to Birds.   Each product starts with the name of the specific animal - for example "Cats-Mouse Toy", "Dogs-Frisbee", "Birds-Rubber_Leaf".  

Now I need to somehow filter out each product so that they go to their proper tables.  As mentioned above, my co-worker was creating a specific filter for each product, but this is proving to be inefficient.  For example, there are 52 different products for Birds alone.  That would mean 52 different filter entries for each product.  What I would like to do is use the LIKE operator but i'm not getting the results I want on the first table.

So, on the first table I need something like:  =(Fields!Products.value LIKE &

Import Access table or Excel spreadsheet into Oracle table


I am trying to import from an Excel spreadsheet or an Access database into an Oracle table.  I used the SSIS Import and Export wizard to create the SSIS packages, but everytime that I attempt to run the package, SSIS stops once it gets to the Pre-Execute phase.  There are never any errors.  Am I doing something that cannot be done?

I'm using the following:  SSIS 2005, Microsoft Oracle OLEDB provider (MSDAORA.1), Excel and Access 2003

By the way, I am able to successfully export from the Oracle database to either Excel or Access using SSIS.


Having trouble updating 1,000,000 row table


Using this T-SQL statement this process should take about 2 minutes.  We know this by limiting the update to 100,000 rows. (the table has an identity field so we can control how many and where to start).  100,000 rows update in 11 sec.  That translates to about 2 minutes for the entire million row table.  There is some kind of problem that resolves itself after a while.  We timed the statement in a larger proc where it was contained and it eventually finished after 2 to 4 hours. 






[Cost] = dw_Prod.

query wich returns records for each day between start date from table 1 and mutation dates in table



I have to tables with dates, table Employments with all employements of all employees, with start date and end date, and a table Mutations with mutations (e.g in salary) with start dates.

Now I try to write a query which returns a record for each day an employee is in employment, with the correct salary. SO at first, it should return all days between the employment start date and the first mutation date, then the number of days between the first mutation date and the second mutation date etcetc, and at last the number of days between the last mutation date and the employment end date. The number of mutations varies for each employment, and employees cna have multiple employments (history, so not at the same time) in the employments table.

How to do this?

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend