473,693 Members | 2,945 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Queries for MSSQL Server

I've got such problem:
My database is stored on MSSQL Server. I have to write reports for it in
MSAccess. I've got a problem with creating a query which will select records
from MSSQL table with date and time values from given range. The difficulty
is mainly caused by the fact, that Date and Time is stored in separate rows
as String . I've tried to use CDate() function in my query, but it worked
well only during tests on small table (about 3000 records). When I linked
the MSSQL Server's table through ODBC it did not work. It did not work
either with imported table (it took some time to import it, as it contains
over 200000 records). My test table (the small one) was created by a
table-making query from the big one. I just selected 3 dates as strings
(.... WHERE ((tbName.Date = "12/07/2004") OR () OR () ...).
Nov 13 '05 #1
14 2463
Kukurydz wrote:
I've got such problem:
My database is stored on MSSQL Server. I have to write reports for it in
MSAccess. I've got a problem with creating a query which will select records
from MSSQL table with date and time values from given range. The difficulty
is mainly caused by the fact, that Date and Time is stored in separate rows
as String . I've tried to use CDate() function in my query, but it worked
well only during tests on small table (about 3000 records). When I linked
the MSSQL Server's table through ODBC it did not work. It did not work
either with imported table (it took some time to import it, as it contains
over 200000 records). My test table (the small one) was created by a
table-making query from the big one. I just selected 3 dates as strings
(.... WHERE ((tbName.Date = "12/07/2004") OR () OR () ...).


Get the DBA fired, get a real DBA who can make a proper database.

This abomination will cause everyone who comes into contact with it
problems until the end of time or until you follow the advice above,
whichever comes first.

--

\\\\\\
\\ \\ Windows is searching
\ \ For your sig.
\ \ Please Wait.
\__\

Nov 13 '05 #2
I would think that you need to try and turn the strings into dates before
you try to filter for the ones you want...especial ly if you are wanting a
range(from date x to date y)

I don't know why the cdate() didn't work on the big table but I am guessing
that is has something to do with the size of the table and the fact that it
is coming in via ODBC.

Is there any way to query the data first in MSSQL before bringing it into
access?
"Kukurydz" <no************ *******@gazeta. pl> wrote in message
news:cg******** **@inews.gazeta .pl...
I've got such problem:
My database is stored on MSSQL Server. I have to write reports for it in
MSAccess. I've got a problem with creating a query which will select records from MSSQL table with date and time values from given range. The difficulty is mainly caused by the fact, that Date and Time is stored in separate rows as String . I've tried to use CDate() function in my query, but it worked
well only during tests on small table (about 3000 records). When I linked
the MSSQL Server's table through ODBC it did not work. It did not work
either with imported table (it took some time to import it, as it contains
over 200000 records). My test table (the small one) was created by a
table-making query from the big one. I just selected 3 dates as strings
(.... WHERE ((tbName.Date = "12/07/2004") OR () OR () ...).

Nov 13 '05 #3

"Trevor Best" <nospam@localho st> wrote in message
news:41******** *************** @auth.uk.news.e asynet.net...
Kukurydz wrote:
I've got such problem:
My database is stored on MSSQL Server. I have to write reports for it in
MSAccess. I've got a problem with creating a query which will select records from MSSQL table with date and time values from given range. The difficulty is mainly caused by the fact, that Date and Time is stored in separate rows as String . I've tried to use CDate() function in my query, but it worked well only during tests on small table (about 3000 records). When I linked the MSSQL Server's table through ODBC it did not work. It did not work
either with imported table (it took some time to import it, as it contains over 200000 records). My test table (the small one) was created by a
table-making query from the big one. I just selected 3 dates as strings
(.... WHERE ((tbName.Date = "12/07/2004") OR () OR () ...).


Get the DBA fired, get a real DBA who can make a proper database.

This abomination will cause everyone who comes into contact with it
problems until the end of time or until you follow the advice above,
whichever comes first.

--

\\\\\\
\\ \\ Windows is searching
\ \ For your sig.
\ \ Please Wait.
\__\

tell me about it. I'm not a dba but I know enough to know not to go puttin
dates and times in as text. (I'm available by the way if you want to hire
me.)
Nov 13 '05 #4

"Kukurydz" <no************ *******@gazeta. pl> wrote in message
news:cg******** **@inews.gazeta .pl...
I've got such problem:
My database is stored on MSSQL Server. I have to write reports for it in
MSAccess. I've got a problem with creating a query which will select records from MSSQL table with date and time values from given range. The difficulty is mainly caused by the fact, that Date and Time is stored in separate rows as String . I've tried to use CDate() function in my query, but it worked
well only during tests on small table (about 3000 records). When I linked
the MSSQL Server's table through ODBC it did not work. It did not work
either with imported table (it took some time to import it, as it contains
over 200000 records). My test table (the small one) was created by a
table-making query from the big one. I just selected 3 dates as strings
(.... WHERE ((tbName.Date = "12/07/2004") OR () OR () ...).


is very bad man who is made your mssql table now is time for GET EVEN!

msql will help get even time ok? goto bad table to open design view. you
change text data type to datetime please.

i make easy example now--

MyDateString = varchar (50)

please now you change--

MyDateString = datetime (8)

please now save. mssql server say in english--

Warning: Data may be lost converting column 'MyDateString' from
'varchar(50)'

is ok for you say ok. goto access please refresh table link in linking
manager. open access table view now you see is REAL dates! is better say
nothing to dba ok? you get even BIG TIME yes?

*Sherwood Wang MVP*



Nov 13 '05 #5
"Sherwood Wang" <sh****@waynes. net> wrote
is very bad man who. . .
you get even BIG TIME yes?


Just for the information of anyone who might be misled, "Sherwood Wang" is
not a Microsoft Access MVP. The list of Microsoft MVPs can be viewed at
http://mvp.support.microsoft.com/def...le=toc#faq1152.

There is a Microsoft Access MVP named Yu Hong Wang, but the referenced post
is not by him; it is from just another sockpuppet of the resident troll and
disruptive poster. MVP Yu Hong Wang would never advise an Access user to
"get even" with a DBA by altering a business database, no matter how poorly
the database seemed to be designed.

Larry Linson
Microsoft Access MVP


Nov 13 '05 #6

"Larry Linson" <bo*****@localh ost.not> wrote in message
news:vdTWc.2385 $2F.2082@trnddc 05...
"Sherwood Wang" <sh****@waynes. net> wrote
> is very bad man who. . .
> you get even BIG TIME yes?
Just for the information of anyone who might be misled, "Sherwood Wang" is
not a Microsoft Access MVP. The list of Microsoft MVPs can be viewed at

http://mvp.support.microsoft.com/def...le=toc#faq1152.
There is a Microsoft Access MVP named Yu Hong Wang, but the referenced post is not by him; it is from just another sockpuppet of the resident troll and disruptive poster. MVP Yu Hong Wang would never advise an Access user to
"get even" with a DBA by altering a business database, no matter how poorly the database seemed to be designed.

Larry Linson
Microsoft Access MVP

I don't see any real difference between Wangs. Why is one Wang any better
than another?

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc

Nov 13 '05 #7
"Sherwood Wang" <sh****@waynes. net> wrote in message news:<eW******* ************@hy dra.nntpserver. com>...
"Kukurydz" <no************ *******@gazeta. pl> wrote in message
news:cg******** **@inews.gazeta .pl...
I've got such problem:
My database is stored on MSSQL Server. I have to write reports for it in
MSAccess. I've got a problem with creating a query which will select

records
from MSSQL table with date and time values from given range. The

difficulty
is mainly caused by the fact, that Date and Time is stored in separate

rows
as String . I've tried to use CDate() function in my query, but it worked
well only during tests on small table (about 3000 records). When I linked
the MSSQL Server's table through ODBC it did not work. It did not work
either with imported table (it took some time to import it, as it contains
over 200000 records). My test table (the small one) was created by a
table-making query from the big one. I just selected 3 dates as strings
(.... WHERE ((tbName.Date = "12/07/2004") OR () OR () ...).


is very bad man who is made your mssql table now is time for GET EVEN!

msql will help get even time ok? goto bad table to open design view. you
change text data type to datetime please.

i make easy example now--

MyDateString = varchar (50)

please now you change--

MyDateString = datetime (8)

please now save. mssql server say in english--

Warning: Data may be lost converting column 'MyDateString' from
'varchar(50)'

is ok for you say ok. goto access please refresh table link in linking
manager. open access table view now you see is REAL dates! is better say
nothing to dba ok? you get even BIG TIME yes?

*Sherwood Wang MVP*


Life is not so easy...
I can't simply change the format of Date and Time rows, because a new
record is inserted every minute. Data is inserted by a SCADA system
(Wonderware InTouch). There is no MSSQL's datetime compatible variable
in InTouch. Perhaps someone could explain me how to create it.
Nov 13 '05 #8
The post with MessageID <vm************ *******@hydra.n ntpserver.com>
is a forgery.

I did not write it.

It shouldn't be very hard for anyone to look at my posts and see
that the headers of the forged post are completely inconsistent with
any of my posts for the last two years or so.

To Don Mellon: Grow up. Get a life.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #9

"David W. Fenton" <dX********@bwa y.net.invalid> wrote in message
news:vm******** ***********@hyd ra.nntpserver.c om...

"Larry Linson" <bo*****@localh ost.not> wrote in message
news:vdTWc.2385 $2F.2082@trnddc 05...
"Sherwood Wang" <sh****@waynes. net> wrote
> is very bad man who. . .
> you get even BIG TIME yes?


Just for the information of anyone who might be misled, "Sherwood Wang" is not a Microsoft Access MVP. The list of Microsoft MVPs can be viewed at

http://mvp.support.microsoft.com/def...le=toc#faq1152.

There is a Microsoft Access MVP named Yu Hong Wang, but the referenced

post
is not by him; it is from just another sockpuppet of the resident troll

and
disruptive poster. MVP Yu Hong Wang would never advise an Access user to
"get even" with a DBA by altering a business database, no matter how

poorly
the database seemed to be designed.

Larry Linson
Microsoft Access MVP

I don't see any real difference between Wangs. Why is one Wang any better
than another?

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc

is because 2 wangs dont make a wong!

is joke yes?

*Sherwood Wang MVP*


Nov 13 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
21021
by: Lars Nielsen | last post by:
I'm trying to execute a long query with mssql_query(), but it fails after 30 seconds. I've tried to use ini_set in my script : ini_set("mssql.timeout", "120"); Both just before the query and before the connection is initiated. I've tried to add this to php.ini : mssql.timeout = 120 But nothing seems to work, mssql_query() in the script still fails after precisely 30 seconds.
7
23869
by: mj | last post by:
Hello, thanks for the help. I am running a WinXP Pro w/ SP2 (my home computer, with ZoneAlarm firewall) Apache 2.0.52 MySQL 4.1.7 PHP 5.1.0-dev I have developed a PHP/MySQL web app that tracks jobs for me, and we
3
4315
by: gharmel | last post by:
I'm trying to get some clues on why I get (much) slower responses from my PHP applications when dealing with a remote sql server as opposed to a local sql server. Here's my situation: Server #1 MSSQL 2000 sp4 Windows 2000 Server PHP4 on IIS5 (CGI)
0
1312
by: intergroove | last post by:
Help. This has been bugging me for a couple of days now: I am writing a script to regularly transfer data from a MYSQL db to a MSSQL. Being new to MSSQL I'm a bit freaked out about the UNIQUEIDENTIFER (UI) system. I have to INSERT data to a table where I need the UI for items from 2 other tables. This negates my ability to use a JOIN. So I need to grab the UI from within PHP and the reference the variable in the query.
6
3092
by: Peter Plate | last post by:
Hi all. I have a system which operates on Windows MSSQL. It is used for registering Suppotr requests. The system works with different Tables inside a Database. One of the tables is for new support calls , another table is for additions to a support call , call_no being the linked cell. I'm using Excell to pull the information from MSSQL with queries. First query for the logged support calls by user :
7
6505
by: Olegus | last post by:
Hello, in order to perform backup/restore MSSQL database using SMO, one needs to reference several namespaces in a backup class : using Microsoft.SqlServer.Management.Common; using Microsoft.SqlServer.Management.Smo; Unfortunately, MSSQL 2005 and MSSQL Express keep them in different place. For MSSQL2005 they are located in C:\Program Files\Microsoft SQL Server \90\SDK\Assemblies and for MSSQL Express you can find them in C:
2
2497
by: gnomee2 | last post by:
Hello Everyone, I have a strange problem that I cannot seem to solve. I have two server running Windows 2003 MSSQL on one IIS on the other. Out of the blue I have slow queries that cause asp script timeouts and I cannot figure it out. I have moved some test code to other sites on the server and still have these long delays. I have tried dropping the tables, then the database entirely and restoring and still slow. I run the same code on...
1
1330
by: tgphelps | last post by:
I've got this 20,000 row table. It had never given anyone trouble. I'm not a particularly good SQL Server admin, but I'm all we have. I was certified on MSSQL 7, some years ago, but it's just a sideline job. Anyhow, about 5 months ago, I was out of town, and a consultant at my site who was apparently a very good MSSQL guy was covering for me. This one table "went crazy". Queries against it, even the Enterprise manager "open table" and "return...
3
2736
by: buntyindia | last post by:
Hi DB2 Gurus, I have a application that using MSSQL database . Now we have to migrate to DB2. I have all the queries. Guide me how to make the MSSQL queries compatible to DB2 is there any tool available or so? Please help
0
8611
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
8549
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
8970
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...
1
8815
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6475
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5824
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
4332
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
4565
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2245
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.