Showing posts with label date. Show all posts
Showing posts with label date. Show all posts

Monday, March 19, 2012

Cant "SELECT" using CREATED_DATE column...help

Ok,
What format is this to where I can't find records (that I know are
there) using this date "2005-09-29 23:58:00".
Here is the SELECT that I use that doesn't work:

SELECT * FROM RMA_HEADER
WHERE CREATED_DATE LIKE '2005-09-29%'

Any help is appreciated.
Thanks,
Trintcreate table MY_RMA_HEADER (CREATED_DATE datetime)

insert into MY_RMA_HEADER values(getdate())
insert into MY_RMA_HEADER values(dateadd(hh, -1, getdate()))
insert into MY_RMA_HEADER values(dateadd(hh, -2, getdate()))
insert into MY_RMA_HEADER values(dateadd(hh, -3, getdate()))
insert into MY_RMA_HEADER values(dateadd(hh, 1, getdate()))
insert into MY_RMA_HEADER values(dateadd(dd, 1, getdate()))

-- it will fetch data for 30th Sept. 2005
-- I have used 103 for formatting, u can use other as well, the idea is
to truncate time part
SELECT convert(datetime, convert(varchar, CREATED_DATE, 103)) FROM
MY_RMA_HEADER
WHERE convert(datetime, convert(varchar, CREATED_DATE, 103)) =
convert(datetime, '20050930' )|||On 30 Sep 2005 04:12:28 -0700, trint wrote:

>Ok,
>What format is this to where I can't find records (that I know are
>there) using this date "2005-09-29 23:58:00".
>Here is the SELECT that I use that doesn't work:
>SELECT * FROM RMA_HEADER
>WHERE CREATED_DATE LIKE '2005-09-29%'
>Any help is appreciated.
>Thanks,
>Trint

Hi Trint,

If the Created_Date is of datetime format, then use

SELECT Col1, Col2, ...-- Don't use SELECT * !!!
FROM RMA_Header
WHERE Created_Date >= '20050929'
AND Created_Date < '20050930'

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)|||>> created_date LIKE '2005-09-29%' <<

Temporal data types are not strings, so you cannot use string functions
on them.

cannot view wsdl of endpoint.

i created this endpoint in SSMS:

Code Snippet

/****** Object: Endpoint [first_Endpoint] Script Date: 06/19/2007 16:39:22 ******/

CREATEENDPOINT [first_Endpoint]

AUTHORIZATION [Domain\username]--scrubbed my username out of post!

STATE=STARTED

ASHTTP(PATH=N'/sql',

PORTS=(CLEAR),

AUTHENTICATION=(NTLM,KERBEROS,INTEGRATED),

SITE=N'sitename,

CLEAR_PORT= 80,

COMPRESSION=DISABLED)

FORSOAP(

WEBMETHOD 'provideInfo'(NAME=N'[adventureworks].[dbo].[uspGetBillOfMaterials]'

,SCHEMA=DEFAULT

, FORMAT=ALL_RESULTS),BATCHES=DISABLED,

SESSIONS=DISABLED,SESSION_TIMEOUT=60,

DATABASE=N'AdventureWorks',

NAMESPACE=N'http://tempuri.org/',

SCHEMA=STANDARD,

CHARACTER_SET=XML)

When i type http://localhost/sql/provideinfo?wsdl into internet explorer, i just get a 404 page cannot be found error.

When i type http://server/sql/provideinfo?wsdl in to the browser i get a Page cannot be displayd error.

I get the same when i type http://myServerName/sql/provideinfo?wsdl

I get the same when i type http://sitename/sql/provideinfo?wsdl

Sql server is running under an account with admin access to the box and sa access to the sql server. what am i doing wrong here that i cannot view my wsdl. oh, the OS is vista.

Could it be a configuration issue that im not seeing?

Can you try the following?
http://localhost/sql?wsdl

See also http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1372924&SiteID=1|||i tried http://localhost/sql?wsdl but still get a 401 not found error. as i am not getting the error speicifed in the link you provided, it would make me think that it is unrelated to my issue. thanks for the reply though.|||

when i use http://server/sql?wsdl i get a 502 error, a connection could not be made as the server actively refused it.

Are there some network settings i should change on my machine possibly?

|||Is server here the same name which you specified in SITE?|||no. the server and the site have different names. I have tried the url both ways though. when i specify the servername in the url, i get an iis page not found error. when i try with the sitename, i get a page cannot be displayed error.|||

The way the 'SITE' keyword value is treated is that it is passed to the OS HTTP.sys service. The HTTP.sys service uses a combination of information to determine which process to redirect the HTTP request to. In this scenario, only HTTP requests send to http://sitename/sql are redirected to this SQL Server endpoint. So, unless machine running SQL Server is named 'sitename', it is very unlikely that the HTTP request will get to SQL Server.

If possible, I recommend changing the SITE value to '*' or the actual machine name.

BTW, I believe the default value for the WSDL generation is NONE, so ?wsdl will get you a 502 HTTP error.

Jimmy

|||

Hi Jimmy.


That indeed was the problem!!! i dropped the endpoint, changed the site name to the name of the pc the endpoint is hosted upon and bingo!!!! cant believe i was so stupid in the first place!!!! it makes total sense now that i look at it! I expected to see the page that comes up when you view the definition of an enpoint in IE, but i also realise that that wont happen. i just see a lot of xml making up the wsdl file, and thats what i required. Thanks for the help and suggestions everyone, and Jimmy, for the answer that gave me the required results.

Sunday, March 11, 2012

Cannot use GETDATE ( ) in a function?

I want to use GETDATE ( ) in a user defined function for date comparing. When I compile the function, got the error:
Invalid use of 'getdate' within a function.
How to get the current date in a function? Any suggestion will be appreciated.
ZYTThe way that SQL 2000 impliments User Defined Functions (UDFs) requires that the functions be deterministic, in other words that for a given set of function arguments the UDF will always return the same result. GetDate() is non-deterministic because it should return a different value every time it is called. Because of that, you can't call GetDate() within a SQL 2000 UDF, although you can use GetDate() as an argument to one and use that argument any way you see fit.

-PatP|||you cannot use a non-deterministic function within a UDF.getdate() is a non deterministic function. So better pass getdate() value as parameter to ur function .There are otherways too.check this link for more details.

http://www.aspfaq.com/show.asp?id=2439

Wednesday, March 7, 2012

Cannot Summerize a formula

Hi

I have a report that has 2 levels of grouping
Group 1 - Date
Group 2 - Customer Ref
This shows for every month how many customers contacted me

I then insert a simple if then formula within the Group 2 line returning me back 1 or 0 if a condition is met.

The problem is, I cannot then sum all the 1's

I will be grateful for any helpInstead of using the formulas and trying to count them you could use a running total that is evaluated whenever the condition is met. In Crystal Reports (http://www.saveonsupport.com) this can be achieved using the formula button in the evaluate on section of the running total.|||Hi

r u sure that the 0 & 1 is in a numeric format, when it is in character format it will not allow to add,

type cast it using 'cDbl' and summerize

Tuesday, February 14, 2012

Cannot save English dates!

Hi All,

I have this dumb problem with dates in my mobile application. The problem is when saving a short date in English format ex 20/08/2006 the sql server 200 windows CE Edition display an error stating

THERE IS AN ERROR IN THE DATEPART FORMAT. [,,,Expression,,]

When changing the date in American format the problem is solved ex 08/20/2006

The problem is that I require the dates in English Format only!

Is there anyway of solving my problem ?

Thanks

Matt

Please use parameters to avoid formatting issues. If you don’t know how, please look up SqlCeParameter class on MSDN and/or search this forum.

Note: SQL CE 2.0 only supports unnamed parameters, SQL Mobile supports both named and unnamed parameters.