Dates Incorrectly Being Saved Incorrectly. DD And MM Swapped Round ?

Jul 23, 2005

For some reason a stored procedure which I have created is incorrectly
saving the date to the table. It seems the day and month are being
swapped around e.g. a date which should be the 12th April (12/04/2005)
is saving as the 4th December (04/12/2005).

The parameter used in the stored procedure comes from a VB6 app, I
amended this so the format was "yyyymmdd hh:mm:ss". The full line in VB
being,

Parameters.Append .CreateParameter("date_of_call", adChar, , 17,
Format(firstCallDateTime, "yyyymmdd hh:mm:ss"))

When I run my VB app it works fine, the syntax in the stored procedure
is,

CREATE PROCEDURE dbo.spUpdValues

@data_id int,
@date_of_call datetime

as

update data
SET date_of_call = CONVERT(char, @date_of_call, 101)
where data_id=@data_id

Is it because the convert format is using an american date format ? I
can't see why as I can't reproduce this error using my own PC as the
date saves correctly, I can also confirm it's not happening to everybody
who uses the app. If it is happening for specifc users then what could
be the cause. I've checked Regional Settings and all seems fine there.

Any ideas on what could be doing this as I'm struggling to investigate
any further.

To debug I ran the stored procedure direct, manually inputting the
variable - again no problem. Also, the following SQL statment shows no
problem...

declare @date_of_call datetime
set @date_of_call = '20041101 08:30:00'

select CONVERT(char, @date_of_call, 101)
select CONVERT(char, @date_of_call, 106)

------------------------------
11/01/2004

(1 row(s) affected)

------------------------------
01 Nov 2004

(1 row(s) affected)

Any help would be much appreciated.

*** Sent via Developersdex http://www.developersdex.com ***

View 10 Replies


ADVERTISEMENT

Dates Being Saved Incorrectly

Apr 10, 2006

Hi,I've got a question about saving into datetime fields in a SQL Server table. A form I have create has two fields both for dates as well as other form fields, but the user may or may not fill in all the form fields, so when they click the save link I have a query which saves all the form fields whether they are blank or not. Unfortunately this is causing the two date fields to be saved in the database as "01/01/1900" even thoough they are blank fields.What is a good way to not save blank date fields as "01/01/1900"?ThanksStephen

View 1 Replies View Related

SUM() Incorrectly Calculates Sum

Jan 2, 2008

Hi all,
 I have an odd issue. I have a query that returns one row from SQL Server.  The value for one column (payment) in this row is 5.00.   There are no other rows returned, only one row.  However, when I do a sum on payment it returns 195!  I dont know where its getting this from, especially since I can see all the rows by removing the SUM() and there only is one row. Here is the query:Select v_payments.tripid, Instransporttotal, lastName, firstName, tripDate, v_payments.payment,credit, translation, inscoid, v_payments.checkid
 from v_billbuckets
left join v_patient on v_billbuckets.patientID = v_patient.ssnleft join v_payments on v_billbuckets.tripid = v_payments.tripid
left join v_InsCompany on v_billbuckets.inscompanyid= v_inscompany.inscoidleft join v_billRecItem on v_payments.tripid = v_billRecItem.tripid
WHERE v_payments.checkID = 315898GROUP BY v_payments.tripid, Instransporttotal, lastName, firstName, tripDate, v_payments.payment, v_payments.credit, translation, inscoid, v_payments.checkid
The above query returns one row.  However, If I put SUM() around v_payments.payment in the SELECT line then it is 195.  I dont know why it is doing this.  Any ideas?
 Thanks!
John

View 2 Replies View Related

.pdf Rendering Incorrectly

Apr 3, 2007

I have a report that is deployed at multiple sites without any problems, except one. At one site, when I render it to pdf, it doesn't look at all right, and the alignment on a table goes from center to right aligned for no obvious reason. It then stretches a textbox horizontally to force it onto another page. I've doublechecked and made sure that all the expand options on every single thing on the report is off, and I really don't understand why it would happen at only one site, even though the data is almost the exact same. Not only that, table cells don't stretch horizontally, they stretch vertically, so again, I'm stumped about why this one site would render incorrectly to a .pdf. Even in the report viewer, everything looks fine.



I am wondering if anyone has had a problem with rendering to pdf incorrectly when the rdl and data are correct, and what your solution was.



P.S. IT isn't a problem with margining, so please, don't give the generic "CHECK YOUR MARGINS" response.

View 3 Replies View Related

Backup's Formatted Incorrectly ?

Feb 25, 2005

I get this message in the SQL Server logs after I restore a db. I copied this backup from another server is that why it's telling me it formatted incorrectly? The strange thing is in QA it restores successfully but when I look @ EM it's remains in Loading mode and never completes



The backup data in 'D:SQLServerMSSQLackupjan_prod_db_20050214173 0.BAK' is incorrectly formatted. Backups cannot be appended, but existing backup sets may still be usable.

View 3 Replies View Related

Report Populating Incorrectly

Aug 29, 2004

I have a customer who is running a script that generates a custom report. IT is not populating as it should and is returning zeros for everything.

I have tested the the script in the office and it is populating as intended. I have run a debug on the script and it is executing the correct SQL commands. The debug results for the customer and for the one tested in the office are identical. For some reason, the script is not writing to file but is looking at the correct data. I suspect that it is an environment issue most likely on the SQL level.

Could this be an issue with character set? How can I check their character set and language preferences? I understand they are set during installation.

They are using the same collation as us.

What else can I check as I am running low on ideas.

I advised the client to create a new DB and restore over the top. The script was then tested and it was found to be working fine. As it was given an inappropriate name (ie test), I advised to create a new DB with a production name and restore over the top again. We have since returned back to where we started as the report is generating only zeros.

H E L P !

View 1 Replies View Related

Sql Server Incorrectly Functioning

Jul 23, 2005

I have a .NET application with a sql server database backend. Ourclient has been having problems lately with data being returned fromthe database with wrong data. We have error logging in our storedprocedures and even this is reporting wrong. In every stored procedurewe have the following:IF @@Error <> 0BEGINEXEC dbo.HandleError@ErrorNum = @@Error,@ProcID = @@PROCIDENDThen, HandleError looks like:CREATE PROCEDURE dbo.HandleError@ErrorNum int,@ProcID intAS/************************************************** ****************** PROCEDURE: HandleError* PURPOSE: Handles logging an error* CALLED FM: Other stored procedures************************************************** ******************/SET NOCOUNT ONDECLARE @UserID intDECLARE @Host varchar(50)DECLARE @Len intDECLARE @SPName VARCHAR(100)DECLARE @ErrorMsg varchar(500)DECLARE @ErrorTrace varchar(4000)-- Get our host nameSET @Host = HOST_NAME()SET @Len = LEN(@Host) - CHARINDEX(':', @Host)IF @Len > 0 AND CHARINDEX(':', @Host) > 0SET @UserID = RIGHT(@Host, LEN(@Host) - CHARINDEX(':', @Host))ELSESET @UserID = NULLSET @SPName = OBJECT_NAME(@ProcID)SET @ErrorMsg = 'SQL Error: ' + @SPNameSET @ErrorTrace = 'Error: '+ CAST(@ErrorNum AS VARCHAR(50))EXEC dbo.InsertApplicationErrors@ErrorMessage = @ErrorMsg,@ExceptionMessage = '',@ErrorStackTrace = @ErrorTrace,@UserID = @UserID,@HostID = @Host,@Logfile = '';SET NOCOUNT OFFGOInsertApplicationErrors inserts a log into a table we have that wemonitor. We got an error back in the ErrorStackTrace column with'Error: 0'. That shouldn't happen, as the only time we log error is ifit is not 0.Does anyone have any ideas on what might be wrong?Steve

View 7 Replies View Related

Unpackdecimal Converts Incorrectly

Jul 10, 2007

I downloaded this 7/6/07 and am trying to debug. I have a field that is PICs9(5) and has 00 00 1D as its hex value. The component returns a dt_decimal field value of 20201-



I believe it thinks the 00 are spaces and converts them to ASCII 20. Any ideas on what is wrong here? Is there another step I am missing after the conversion? Any help would be appreciated.



View 1 Replies View Related

Data Incorrectly Repeating Itself

Aug 3, 2007



I have run into a strange issue that I believe is a SQL Reporting Services issue.

I have a report laid out in landscape setting that has 4 columns of text. Two of the columns are sub-reports (due to the complexity and size, we did not flatten out the data in the stored procedure) and two of the columns are regular fields.

The 2 columns of regular fields are smaller, and normally only grow to about 1/2 the height of he page. One of the two sub-reports contains large amounts of text, and at time grows larger than the height of the page.

When the sub-report grows larger than the current page, it correctly starts up on the next page. But the 2 fields of data from the main dataset (not the sub-report columns) repeat themselves on the next page as well.

What is even more strange is the 2 fields of data from the main dataset only repeat data to grow vertically as far as the sub-report needs to grow. So if there is more data in either of these 2 fields than is needed for the sub-report to grow on the 2nd page, it will cut off the data in both of these fields.

I have tried placing the information in a group header. Turned the "Repeat on new page" both True and False, Took away the table header and footer, forced a page break after each group, tried using the "Hide Duplicates" property on the field within the details section, and nothing has seemed to fix the issue.

If anyone has run into this and found a work around, let me know.

Thank you,

T.J.

View 1 Replies View Related

SQL Server 2005 Always Intsalled Incorrectly On My PC

Mar 19, 2008

 Hello All:I tried many times to install SQLserver 2005 on my My PC (VISTA Ultimate version). I always find configuration tools and working properly and can start any services and stop but I searched everywhereto find sql server management studio  (SSMS) to connect but I don't find it ..... can someone help me because I've uninstalled and re-installed it many times but not found........ 

View 13 Replies View Related

Backups Failed - .BAK Incorrectly Formatted ?

Aug 3, 2002

What does this error message mean ? We have SQL2000, with database FULL RECOVERY. Other databases on the server are fine. Backups stopped working a week ago. Can't remeber anything changing
+++++++++++++++++++++++++++

The backup data in 'D:BackupTI backup.BAK' is incorrectly formatted. Backups cannot be appended, but existing backup sets may still be usable. [SQLSTATE 42000] (Error 3266) BACKUP DATABASE is terminating abnormally. [SQLSTATE 42000] (Error 3013). The step failed.

View 1 Replies View Related

Run Status Of Log-reader-agent Job Is Displayed Incorrectly

Jun 12, 2002

hi,

among our server-agent jobs is one for the log-reader-agent and its run status is displayed as error though the log-reader is working correctly, replication is working fine.
it had hit an error some days ago after an unexpected shutdown - but it has been auto-restarted correctly on restart of the sql-server agent.
now - what can i do to get back to a sensible run-status report?
i have already deleted the job-history with the hope that this might help - but it didn't. should i just stop and restart the job again?
can i somehow delete the status in the jobhistory?
i would gladly appreciate any ideas because it's making me just mad to have a 'failed' job status on the monitor *g*

thank you,
kerstin

View 1 Replies View Related

Derived Columns Expressions Evaluate Incorrectly

Oct 26, 2007

All,

I have seen it happen frequently that I type in a perfectly valid SSIS expression (this is easy for me since I am an old hand at C++/C/C#) in a row in a Derived Column transformation, and it turns red. Or sometimes, I will have an invalid expression that I correct, but it stays red. Finally I have also seen it happen that I make some change in the data flow pipeline and suddenly a Derived Column transform develops an error. I then go into the Derived Column transform and find that the expression has turned red. So, I literally have to go into the expression in these cases, and make a trivial change to them to get the red error to go away. Alternatively, I can cut the derived column expression text, and then paste it back in and it works (this is most telling.)

So, it seems to me the Derived Column is somehow holding onto some meta data about the Derived Column that is getting out of date (rather than re-evaluating the correctness of the Expression.) One thing I usually can do to repro this at times is to remove a column (that the Derived Column depends upon) from the pipeline and then re-add it. When I go into the Derived Column it will be red, and then like I said I have to tweak the expression to force SSIS to re-evaluate the expression.

Anyway, I'm curious if anyone else has seen this?

Thanks.

View 10 Replies View Related

Date Parameter Format Incorrectly Interpreted

Oct 18, 2005

Hi,

View 11 Replies View Related

Source Data Types In Excel Defined Incorrectly

Apr 9, 2008



I'm trying to import some data from an Excel 2007 file into a SQL table. I created the Source Connection Manager and an OLE DB Source Data Flow Component which uses it. (Correct me if I'm wrong, but I can't use the Excel Source because of the version of Excel the file is saved in.) The outgoing Data Flow Path thinks some of the fields being imported should be of type float, when in fact they have alpha characters in them.

The fields in the database are defined as varchars.

A Data Conversion Transform doesn't seem right because I need the data to come out of the source as string data (which it actually is in the Excel file). Even if I convert it to string on the way to the destination, I would still be missing the original alpha characters.

How/Where do I change it (Source Connect Manager, OLE DB Source Data Flow Component, something else) to correctly identify the field's type?

TIA,
Christy

View 1 Replies View Related

Need Help: With Dutch Regional Options, MS SQL Server BCP Incorrectly Delivers Values

Aug 27, 2004

Hi all,

With Windows regional options are set to Dutch/Netherlands (or any other country using comma as the decimal symbol), MS SQL Server BCP Delivers incorrect figures to the target table.

The source table is a text file containing commas as the decimal character (As an example, in the text file 100.000 is represented as 100,000).

The target table is a Sql Server database table, with the column in question defined as a FLOAT datatype.

When BCP is run to deliver the data from the text file to Sql Server,
all figures are multiplied by 1000 because the input file for BCP contains a comma as the decimal symbol.

Thus, instead of the data being delivered with a value of 100, it ends up having a value of 100000

Is there anyone out there who is aware of any command line parameters that can be added to the bcp command in order to avoid this ? Note, the field in question is defined as SQLCHAR in the BCP format file.

Thanks for any help anyone may be able to offer.

View 2 Replies View Related

Weird Replication Bug. Bulk Data Stream Was Incorrectly Specified As Sorted.

Apr 17, 2006

before anyone even says it, i checked the collation order on everything and it's the same. i get the error when the snapshot is trying to be bulk copied to the subscriber.

i'm on sql2k sp4, server and db collations are SQL_Latin1_General_SP1_CI_AS. here's a repro. 1st, run this in a blank db:

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Event_Transactions]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Event_Transactions]
GO

CREATE TABLE [dbo].[Event_Transactions] (
[EventTransactionId] [int] IDENTITY (1, 1) NOT NULL ,
[OrphanedFlag] [bit] NOT NULL ,
[ProcessedFlag] [bit] NOT NULL ,
[ProcessedTimeStamp] [datetime] NULL ,
[EventTimeStamp] [datetime] NOT NULL
) ON [PRIMARY]
GO

CREATE CLUSTERED INDEX [EventTransactions_IDX_ProcessedOrphanedEventTimeSt amp] ON [Event_Transactions] (
[ProcessedFlag],
[OrphanedFlag],
[EventTimeStamp]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[Event_Transactions] ADD
CONSTRAINT [PK_Event_Transactions] PRIMARY KEY NONCLUSTERED
(
[EventTransactionId]
) ON [PRIMARY]
GO

insert into Event_Transactions (
OrphanedFlag
,ProcessedFlag
,ProcessedTimeStamp
,EventTimeStamp
)
values (
1
,0
,NULL
,'2004-05-07 15:15:24.000'
)

insert into Event_Transactions (
OrphanedFlag
,ProcessedFlag
,ProcessedTimeStamp
,EventTimeStamp
)
values (
0
,1
,'2004-07-08 13:04:01.513'
,'2004-07-07 16:52:08.000'
)

Now, use transactional replication to replicate it to another db taking all the defaults. when the distribution agent tries to apply the snapshot, it fails with the message mentioned in the title..

Has anyone ever seen this? It's keeping us from considering MS replication for one of our major products. Thanks.

View 1 Replies View Related

Reporting Services :: RDLC Reports Render Fonts Incorrectly

Apr 8, 2011

We have this problem?

View 5 Replies View Related

SQL Server Express SP2 Advanced Services Shows Up Incorrectly In Installed Programs

Apr 5, 2007

Could someone from the SQL Server Express team confirm that SQL Server Express SP2 w/Advanced Services shows up as "SQL Server 2005" in the installed programs list? The "Express" portion seems to be missing. And how would one tell the difference between the Standard Edition and the Express Edition based on this?


Thanks.

View 1 Replies View Related

SQL Server 2005 Trying To Restore Get Error Media Family Incorrectly Formed

Jul 30, 2007

I am trying to restore a 2005 backup to a 2005 database on another server. This has worked for me before. I have tried to take the backup 5 times now and each time I get the error media family incorrectly formed. Since I have successfully backed up and restored before between these same two databases I do not understand what is wrong now.

I found other questions with this error; however, they were taking a 2000 backup to a 2005 database. I am using a backup of a 2005 database to a 2005 restore.

How should I begin to debug this problem?

Thanks

View 3 Replies View Related

Using A Varchar Versus A Nvarchar Causes Hungarian Characters To Be Displayed Incorrectly On The Webpage.

Jul 10, 2006

I have a hungarian character which looks like a lower case o with two single quotes on top of it --> ő

I have this character stored in two table the datatype of the column where this is stored at is varchar in one table and nvarchar in the other. When I try to view the field in enterprise manager the character appears as it should in the 2 tables, but when I use a jsp page deployed on weblogic to look at this character the one stored in the column of type varchar displays perfectly, but the table in which the column is nvarchar the character on the jsp page appears as a Q instead.

Any inputs on how to correct this issue will be much appreciated. Any changes to the character set on the html / jsp pages has no affect on the result.

Thanks,

Manisha

View 1 Replies View Related

Report Server Viewer Renders Incorrectly But Exporting Yields Correct Output!

Aug 8, 2007

I have a rather complicated report with lots and lots of textbox and line controls. When I preview the report on the Report Server the layout is all kinds of skewed and all kinds of stuff is out of place. But when I export the report to PDF or TIFF, the output reverts to it's proper form. Why is it doing this? Is there anything that I can do to not make it so ugly when previewing?

View 2 Replies View Related

SQL Server 2005 Incorrectly Claims I Don't Meet Minimum Service Pack Level Requirements?

Feb 10, 2006

This doesn't make any sense. I am trying to install SQL Server 2005 on SBS 2003 with Service Pack 1. According to Windows Update, there is nothing left for me to install. However, I am getting this error (while installing SQL Server Express and the Developer Edition):

"Your operating system does not meet Service Pack level requirements for this SQL Server release. Install the Service Pack from the Microsoft Download Center at http://go.microsoft.com/fwlink/?LinkId=50380, and then run SQL Server setup again."

When I go to the link, there is nothing there to download (it takes me to the main Microsoft download page). I meet all the requirements that I have found. What gives?

Thanks,

Scott

View 36 Replies View Related

Dates Saved As Different Format

Dec 4, 2007

I recently wrote a stored procedure to add the date and time to an existing table. The date is being stored as
Oct 29 2007 5:37PM

Instead of as
10/29/2007 5:37:23 PM

The column is a varchar(24) data type and I use GETDATE() in the stored procedure to supply the date.

What do I need to do to change to get this to save the date as mm/dd/yyyy



Miranda

View 4 Replies View Related

Where Are The SSI Files Saved When Saved To The Server?

Apr 20, 2006

This is a pretty simple question, but I'm going nuts trying to find the answer. After creating an SSI package, I told it to save to the SQL server... Now where do I go to pull that package up again and make changes and/or execute the package?

View 4 Replies View Related

Reporting Services :: Colors Get Swapped On Stacked Column Chart (SSRS R2 2008)

May 7, 2015

I have a report in which I have assigned custom colors with a function to one of my stacked column charts. When I run it in the report builder, the colors are correctly placed, but as soon as I upload the report to the server and view the report from there, the colors get swapped. I have these custom colors applied to other stacked column charts in the report and they work perfectly fine. The only difference between this chart and my other charts is that it contains two category groups.

EDIT: Alright, I have gotten it to display the correct colors by using a function with the colors I wanted in reverse. I have two values, "Upcoming" which is displayed in red, and "Outstanding" which is displayed in blue. If the chart has only upcoming values, it will display in blue rather than red, whereas if I have upcoming and outstanding values, they will display in their correct colors. why this is occurring?

View 2 Replies View Related

T-SQL ROUND(decimal, Int) Vs C# Round(Decimal, Int32)

Jan 30, 2006

Anybody noticed that SQL Server rounds up if the value is half waybetween two rounded values, but C#'s Decimal.Round(Decimal,Int32)rounds to nearest even number?[color=blue]>From MSDN: "When d is exactly halfway between two rounded values, the[/color]result is the rounded value that has an even digit in the far rightdecimal position. For example, when rounded to two decimals, the value2.345 becomes 2.34 and the value 2.355 becomes 2.36. This process isknown as rounding toward even, or rounding to nearest."I perform the same calculation sometimes on the web server in C# andsometimes at the database in T-SQL, but want to get the same resultfrom both calculations. Could anybody offer any strategies for dealingwith this?Thanks ~ Matt

View 3 Replies View Related

Want To Use Parameters To Filter For Dates Between Two (parameter, User-input) Dates

Mar 2, 2006

SQL 2005 Dev

How can I do this with Parameters? I can get a single parameter to filter for a single date (or even a combo list of the dates in DB). But I want my parameters to interact so that they specify a range. Is this possible?

View 3 Replies View Related

T-SQL (SS2K8) :: Calculate Sum Of Dates Minus Repetitive Dates

Jul 18, 2014

Today I have got one scenario to calculate the (sum of days difference minus(-) the dates if the same date is appearing both in assgn_dtm and complet_dtm)/* Here goes the table schema and sample data */

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[temp_tbl]') AND type in (N'U'))
DROP TABLE [dbo].[temp_tbl]
GO
CREATE TABLE [dbo].[temp_tbl](
[tbl_id] [bigint] NULL,
[cs_id] [int] NOT NULL,
[USERID] [int] NOT NULL,

[code]....

View 9 Replies View Related

Round Up

Sep 14, 2006

X is a float and I need to perform x/10 and round the result up to the integer. So if result is 0.4 -> 1, if 1.1 -> 2. How can I do this with SQL? 

View 1 Replies View Related

Round Up And Round Down In Sql

Sep 9, 2007

 I want to do a simple thing but it seems to be behaving not as i am expectingI want to round number either up or down....e.g: 4.3 should round to 4  4.7 should round to 5when i use the round function like this:  83/17=4.88round( 83/17 , 0 ) it gives the answer as 4....when i was expecting it to be 5.... i know there is a ceiling function...but depending on the value of the division sometimes i want it to round up and sometimes round down. how can i do this? hope this makes sense. thanks  

View 3 Replies View Related

Round Bug

Mar 25, 1999

Has anyone been experiencing problems with rounding to 2 decimal places in SQL 7? I have a bunch of queries that generate web reports. Under 6.5 everything was fine. Now under 7.0 any number that needs to be rounded to 2 decimals is actually giving me several decimal places.

Here is a simplified version of what I am doing:
DECLARE @x real
DECLARE @y real
SELECT @x = 223.1
SELECT @y = 59.7

SELECT ROUND((@x/@y),2)

Result should be 3.74. But instead I am getting 3.7400000000000002

If anybody has heard if Microsoft has declared this as a known bug please let me know.

Thanks for your time.

View 1 Replies View Related

Round ?

Aug 22, 2002

I have the statement below which I use in an update

select (round(sum(tottime/60),2)) as ttime from vw_cms_suptime
where vw_cms_suptime.[tracking number] = 970
tracking.[tracking number]

Even though I have the round the statement returns a value
of 5.0000000000000003E-2

Is there something wrong with the round?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved