Weird Date Transformation

Jun 15, 2004

Hi all,

i 've got a real strange problem.
I 'v got an asp.net/vb.net application and a mssql db at the end. I have a form where I can insert some info in the tables. Everything went well for a couple of months, but now my dates transform on a real strange way. no matter wich date I give up, those date's never reach the db.
example: date = 31-12-2004(Europe date) --> in the db the date is
21-07-1894
and I've seen the other dates, the month and the year are the same, they all show me july 1894.

Has everyone ever seen this before.

PS. I'm using win2000 service pack 4 with mssql 2000 (no service pack)

View 8 Replies


ADVERTISEMENT

Weird Date Rounding

Jul 20, 2005

SQL Server 7.0The following SQL:SELECT TOP 100 PERCENT fldTSRID, fldDateEnteredFROM tblTSRs WITH (NOLOCK)WHERE ((fldDateEntered >= CONVERT(DATETIME, '2003-11-21 00:00:00',102))AND(fldDateEntered <= CONVERT(DATETIME, '2003-11-23 23:59:59', 102)))returns this record:fldTSRID: 4fldDateEntered: 24/11/2003Hello? How is 24/11/2003 <= '2003-11-23 23:59:59'?I tried decrementing the second predicate by seconds:(fldDateEntered <= CONVERT(DATETIME, '2003-11-23 23:59:30', 102)))returns the record, but(fldDateEntered <= CONVERT(DATETIME, '2003-11-23 23:59:29', 102)))does NOT.What is happening here?Edward============================TABLE DEFINITION:if exists (select * from dbo.sysobjects where id =object_id(N'[dbo].[FK_tblTSRNotes_tblTSRs]') and OBJECTPROPERTY(id,N'IsForeignKey') = 1)ALTER TABLE [dbo].[tblTSRNotes] DROP CONSTRAINT FK_tblTSRNotes_tblTSRsGOif exists (select * from dbo.sysobjects where id =object_id(N'[dbo].[tblTSRs]') and OBJECTPROPERTY(id, N'IsUserTable') =1)drop table [dbo].[tblTSRs]GOCREATE TABLE [dbo].[tblTSRs] ([fldTSRID] [int] IDENTITY (1, 1) NOT NULL ,[fldDealerID] [int] NOT NULL ,[fldWorkshopGroupID] [int] NULL ,[fldSubjectID] [int] NULL ,[fldReasonID] [int] NULL ,[fldFaultID] [int] NULL ,[fldContactID] [int] NULL ,[fldMileage] [int] NULL ,[fldFirstFailure] [smalldatetime] NULL ,[fldNumberOfFailures] [int] NULL ,[fldTSRPriorityID] [int] NULL ,[fldTSRStatusID] [int] NULL ,[fldAttachedFilePath] [char] (255) NULL ,[fldFileAttached] [smallint] NOT NULL ,[fldFaultDescription] [ntext] NULL ,[fldFaultRectification] [ntext] NULL ,[fldEmergency] [int] NOT NULL ,[fldDateEntered] [smalldatetime] NOT NULL ,[fldEnteredBy] [int] NOT NULL) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]GO

View 8 Replies View Related

Weird Date Query Problems

Jul 20, 2005

I'm having a fit with a query for a range of dates. The dates arebeing returned from a view. The table/field that they are beingselected from stores them as varchar and that same field also storesother fields from our dynamic forms. The field is called'FormItemAnswer' and stores text, integer, date, float, etc. Anythingthe user can type into one of our web forms. The query looks like,select distinct [Lease End Date] fromvwFormItem_4_ExpirationDateOfTerm where CONVERT(datetime, [Lease EndDate], 101) >= CONVERT(datetime, '08/03/2003', 101) ANDCONVERT(datetime, [Lease End Date], 101) < CONVERT(datetime,'09/03/2003', 101)The underlying view does a simple select based on the particular formfield, lease end date in this case.This query works fine with 1 date in the where but with two fails withthe dreaded 'syntax error converting to datetime from varchar'.What appears to be happening is sql is trying to do the CONVERTSbefore it filters with the WHERE clause in the view.I tried using a subquery but it still seems to do the same thingsomehow!SELECT *FROM (SELECT *FROM vwFormItem_4_McD_Lease_4B_ExpirationDateOfTermWHERE isdate([Lease End Date]) = 1 ) derivedWHERE (CONVERT(datetime, [Lease End Date], 101) >= CONVERT(datetime, '#8/3/2003', 101)) AND (CONVERT(datetime, [Lease End Date],101)<= CONVERT(datetime, '9/3/2003', 101))I've tried everything I know to try like doing the CONVERT inside theview I'm selecting from, doing a datediff, everything. Really goincrazy here.Any ideas would be greatly appreciated!Russell

View 4 Replies View Related

Help, Weird Int To Date Data Conversion

Dec 5, 2007



I need to convert an integer value fo for example 1071123 to a date field. This value would represent 107 = Year 2007, 11 = Month November, 23 = 23rd day of month. So effectively this would translate to 2007-11-23 00:00.000.

I would like to do this in the Integration Services package. I am retrieving data from an AS/400 system to an SQL Server DB. I'm not sure if I can do this with the Derived Column object or is there a better way to achieve this conversion.

Please, can anyone shed some light on this for me?

Thanks
CdnGator (Jason)

View 4 Replies View Related

How Can NULL Be Equal To Today's Date (was Weird Query Behavior Plz Help)

Feb 7, 2005

I have a query that is behaving a little a weird. here is the example:

i have 1 table in this table i have 2 columns wich are date and time

DATE_DEBUT_PERIODE_FISCALE DATE_FIN_PERIODE_FISCALE
------------------------------ ---------------------------
1/27/1997 2/27/1997
1/1/2005 2/6/2005

here is my query:

BEGIN
declare @datefin_flag datetime, @strip datetime
SELECT @strip = dateadd(d,datediff(d,0,getdate()),0)
SELECT @datefin_flag = DATE_FIN_PERIODE_FISCALE FROM DM_LKP_CALENDRIER_PERIODE_F
WHERE DATE_DEBUT_PERIODE_FISCALE < @strip AND DATE_FIN_PERIODE_FISCALE = @strip
--select @datefin_flag
--select @strip
IF(@datefin_flag != @strip)
RAISERROR('You cant run this',16,1)
END

Well this Query should return the raiserror it returns completes successfuly
since todays date is not the same as the date in the database.
if you select @datefin_flag it returns NULL and if you select @strip it brings back todays date how can NULL be equal to to todays date assuming that todays date is equal to NULL. ?

View 7 Replies View Related

Weird One. An Internal Error Occurred On The Report Server. (System Date?)

Mar 27, 2006

Hi guys,

We've had Reporting Services running in a production environ. for 6 months fine, but from Saturday every report now causes the following error (in both the Report Manager and Soap calls):

An internal error occurred on the report server. See the error log for more details. (rsInternalError) Get Online Help

Specified argument was out of the range of valid values. Parameter name: date

Now, before you jump to conclusions - this error is occurring on reports with both parameters and no parameters (ie in reports that have no "date" parameter in the report).

The next bit of info is the weird bit...

It was working on Friday (25/March/2006) - so as a test, i switched the servers clock back to Friday - and BINGO... it worked. Then I changed it to Saturday (26th March) and it doesnt work. In fact for the next 7 days - the service will not work until April 2nd 2006 - (when I changed the systems date to the 2nd it worked again.) Moving forward, it looks like its working fine.

Does anyone have any suggestions? This is in a production environment, so obviously changing the sytsem date as a quick fix workaround wont suffice.

Thanks in advance.

Grey



View 1 Replies View Related

Date Transformation

Apr 26, 2004

What is the fonction to use in order to format a date to char?
for instance have the date under the following format :
ddmmyy or dd/mm/yyyy ...

Thanks

View 1 Replies View Related

Date Transformation

Jun 24, 2007

hi all, i am trying to convert getdate()to yyyymmdd type of output using derived column transformation and this transformation doesnot recognise CONVERT function.
this is what iam trying to do
2007-01-01 00:00:00.000 to 20070101

View 2 Replies View Related

Convert The Format Of A Date Time String Transformation....

Jul 27, 2004

Im working with a breaking system and I wont to convert the (FROM) datetime column to accept just time like (4:00:00 AM) without the date (7/23/2004) but it doesn’t have column format like the access ??
I found something in the SQL help :

How to convert the format of a Date Time String transformation (Enterprise Manager)
To convert the format of a Date Time String transformation
1.On the Transformations tab of the Transform Data Task Properties or Data Driven Query Task Properties dialog box, click the Source column containing the date or time to be modified, and then click the Destination column where you want the modified string to be placed.
2.Do one of the following:
•If there is a mapping arrow connecting the two columns, click Delete, and then click New.
•If there is no mapping arrow, click New.
3.In the Create New Transformation dialog box, click DateTime String.
4.Click the General tab, and then click Properties.
5.In the Date Format list, select the format you want.
6.Click Naming to display the Calendar Names dialog box, where you can select long or short day or month names and the A.M. and P.M. designators you want.
7.In the Language list, select the language you want, and then click Set Language Defaults.
But unfortunately I didn't find the "Transformations tab" I look a lot in the SQL Enterprise Manager

Do anybody work with the Transformations or at least know where is it please ???

View 1 Replies View Related

Does A Synchronous Transformation Process All Rows In A Buffer Before Outputting To Next Transformation?

Jun 5, 2006

Hi,

If you have two synchronous transformation components and the input of the second is connected to the output of the first, does the first transformation process (loop through) all rows in the buffer before outputting these rows to the second transformation? Or does the first transformation output each individual row to the second transormation as soon as it has finished processing it?

Thanks in advance,
Lawrie.

View 5 Replies View Related

Integration Services :: Difference Between Audit Transformation And Row-count Transformation?

Apr 22, 2015

tell me the difference between Audit transformation and rowcount transformation.

Because audit and rowcount transformation will provide the environment variables.

Only difference i am finding is rowcount returns the count of rows its updating .

Apart from these is there any other difference?

Tell me the scenario where i need to use the audit transformation.

View 3 Replies View Related

Here Is A Weird One!!

Sep 24, 2001

I have a dts package that is mysteriously changing back to a previously saved version. Package is saved, and re-opened with saved changes, then moments later opened again to have been reverted back to an older version. Has anyone ran into this before?
The only thing that I can think of is that if a version of the package is left open on some other machine (as the older version0, it may be auto-saving, and reverting back.

View 3 Replies View Related

Really Weird One Here...

Mar 31, 2008

I run a website, so all of this is done remotely, I do not have access to the servers directly.

On my prior host, everything on the DB worked just fine. Had it optimized and running pretty good for the site by adding indexes, etc.

Then I moved to my new faster server (new host) and at first everything seemed to be just fine. However, some users started complaining about speed in spots.

Sure enough when I checked a given page -- WHAM... the page took about 14 seconds to load. Not exactly fast. :)

So I checked to make sure the indexes copied over and sure enough they did. But it was still slow, even in Query Analyzer/MSE.

So I decided to rerun my view script... on a lark... just to see if that affected something. And sure enough it did. The page started running at 1 second or less. OK, I thought, the view just got corrupted or something.

All was fine until the next night when it happened again. I had added 12 new rows to the table (I do this nightly) and it seemed that adding the new rows slowed down the system. Until the view was rebuilt. With that done again, it's worked fine.

But each night now I have to rerun that view.

What gives??? Is there a DB setting or something causing views/indexes to not be maintained?

The prior server was 2000 or 2003. The new one is 2005.

Again, I cannot get access to the box itself except through Management Studio. The host's tech support group is less than useless, treating everyone as incompetent before they help you.

Any hints or solutions would be a big help!

View 8 Replies View Related

Weird E&#043;006

Mar 12, 2008

I'm trying to CAST an integer to a varchar and I keep getting e+006 in my result set. The reason I need to do this is so that I can combine 2 columns to return a string.

Here is my table:

incomeBracket | lowIncome(int) | highIncome(int)
-----------------------------------------------
1 1000001 5000000
2 5000001 10000000

Here is my query:

SELECT CAST(incomeLow AS varchar) + ' - ' + CAST(incomeHigh AS varchar) AS incomeRange
FROM IncomeBracket_Currency

How can I get my result to look like this:

1000001 - 5000000
5000001 - 10000000

Instead of what it is returning now:

1e+006 - 5e+006
5e+006 - 1e+007

The query works fine for values that have a character length of 6 and less.

Thanks in advance.

View 3 Replies View Related

A Weird Error !

Jul 25, 2006

I was developing a data-driven website but I got this error
An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
 
(I have Sql server 2005 also downloaded before)
Please help me cause any website that has data can not be executed even the quick start tutorial that ships with the ASP.NET 2.0
What should I do?

View 1 Replies View Related

Weird Concantenation

Nov 14, 2006

Hello and thanks for taking a moment to read this message.I have two colums from which I am taking values. One of which(a bit field), i am running a CASE statement against it to get SQL Server to return a string. The other is just a simple varchar column. My SELECT statement for the columns look like this:
SELECT Case tblDisplayProfile.Approved When 0 then 'Not Approved' when 1 then 'Approved' else 'Not looked at' END AS Approved, tblDisplayProfile.DisplayProfileDesc
These statements do return me something. Now what I want to do is combine (concantenate) the two fields. This is where I have problems. Any suggestions would be greatly appreciated.
 
Jason

View 13 Replies View Related

Weird Ado.net 2.0 Error

Nov 19, 2006

Why does ado.net produce this error when I kow for a fact that there are no connections to any sql server 2005 database involved - this could and probbaly has had people off looking at the wrong connection strings in their web.configs.
Note:- The connection string we have is to a sql 200 db I just wanted to make that clear.
CheersGegor
Error Message:An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)Stack Trace:   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)   at System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup)   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)   at System.Data.SqlClient.SqlConnection.Open()   at System.Web.SessionState.SqlSessionStateStore.SqlStateConnection..ctor(SqlPartitionInfo sqlPartitionInfo)

View 8 Replies View Related

Weird Problem

Jun 5, 2008

Hi, I moved a SQL 2000 DB to a SQL 2005 server.    When I run my .NET 1.1 or 3.5 website to call a stored procedure it returns the wrong results.The SQL stored proc runs fine when I excute it within SQL Manager  but gives a different result when called via  .NET The funny thing is I have 3 SQL servers 2000 , 2005 , and another 2005. The same data on each of the databases and the same website.  Two of the databases work but the second 2005 database my production server decrements the dates some how.  The funny thing is the stroed proc is not returning dates as such but a varchar of the name of the day that's getting decremented. My stored proc is SELECT

Case datepart(dw, DT_DATE)
When 2 Then 'Mon'
When 3 Then 'Tue'
When 4 Then 'Wed'
When 5 Then 'Thu'
When 6 Then 'Fri' End AS [WeekDay],
Sum(VL_HOURS) as Total

FROM ...

WHERE ....

GROUP BY datepart(dw, DT_DATE) and My c# .net code is "SqlHelper.ExecuteReader( connectionstring, storedproc, paramaeters);"using MS.ApplicationBlocksWhat happens that from sql, and 2 of my websites is when week day = 4 it returns   "Wed"    However on my Production server it returns "Tue" ??? 

View 4 Replies View Related

Weird Error

Mar 18, 2004

i have a form which takes in a lot of input...one of them is a date field..am passing all the values to the stored proc and inserting into a table from there...pretty simple...however when the user does not enter any value in the field...its errors out as...

String was not recognized as a valid DateTime.

heres the code in asp.net

myCommand.Parameters.Add(New SqlParameter("@cusbday",SqlDbType.datetime))
myCommand.Parameters("@cusbday").Value = trim(bday.text)


the field is optional....in my stored proc i am setting a default value too

....@cusbday Datetime =NULL,...

i also xplicitly set it to null through code
if @cusbday is null set @cusbday=null


how else do i resolve this...

thanks

View 13 Replies View Related

Weird Question

Apr 25, 2001

Hello!
MSSQL Server 7.0 SP1
When I open DTS designer for some unknown reason I'm getting error message "Could not create Component Categories manager".
Then under Task I don't have any choices.
Is there a quick way to fix it?

Thanks

Lena

View 1 Replies View Related

WEIRD ERROR

Feb 20, 2001

I was running a DTS package which transfer a complete database, about 2.3GB in size, to another database on the same server. It was necessary for environment change from dev to QA. I baby sat the package till it was rebuilding indexes (90%) complete. This morning I have the following error message on my screen,

[Microsoft][ODBC SQL Server Driver][SQL Server]
[Microsoft][ODBC SQL Server Driver][SQL Server]Location: r:SPHINXNTDBMSqueryqeexecqsxchng.inl:749
Expression: (m_cbPageMac + ulPxvarSize) <=m_pxpktdesc->m_cbPageMax
SPID: 40
ProcessID: 347

I have no idea at this time what caused it. And as far as I can tell there in r drive mapped wither on the serve or my computer ( I was running the DTS package from my machine).Any help is appreciated

View 1 Replies View Related

Really Weird SQL Failure

Jun 9, 2003

Last night our production server went crazy. The primary (production) database MDF file had size 15Gb and then for some reason the size became 0 (zero) K, So the SQL right away reported the error:

I/O error 38(Reached end of file.) detected during read of page buffer..

Error: 823, Severity: 24, State: 10

And the database became "suspected".
Now we restoring it, but have anybody seen such a thing before? I'm breaking my head to figure out what could cause this problem!!!!!

Dim

View 5 Replies View Related

Weird Prob!!!HELP

Aug 1, 2002

Whenever I am creating a new database, I am not getting any system stored procedures created :o( the system tables & views are created though :o(
what maybe the problem?

thanks!

View 4 Replies View Related

Weird Behaviour On Net Use

Jul 5, 2004

When I run the command:
exec master..xp_cmdshell 'NET USE'
from the analyzer the box responds there are no entries in the list.

After that, I run the command:
exec master..xp_cmdshell 'NET USE Z: /DELETE'
after which the box responds with a "network connection could not be found."
and that's all okay.

The weird thing is:
exec master..xp_cmdshell 'NET USE Z: \MACHINESHARENAME'
results in a "The local device name is already in use.".

The machine in this particular case is the box itself. I have no problem accessing other disks on other systems. I can see the share using the view command. There's no maximum on the share itself and I can connect to the share using another sql box with the same user.

I don't know why it won't budge, worked before like a charm. After six months or so it just stopped. Anyone seen/solved this behaviour?

thanx,

View 5 Replies View Related

Weird DateTime Value

Dec 20, 2004

I have a datetime field with a value of '-28049-03-16 10:01:16.267' in SQl Server 2000. I haven't a clue how or why this value was entered as I did not design or write the database. However, I do have the task of writing a DTS package to export the data to Access. The problem is that the DTS fails when it tries to export the record with the above value into an Access table with a Date/Time field. I thought I could get round this by using a UDF to say if the date equals this value then make it null:

RETURNS DateTime

As
BEGIN
DECLARE @CheckDate varChar(300)
SET @CheckDate = CONVERT(varChar(300),@Date)

IF (@CheckDate = '-28049-03-16 10:01:16.267')
BEGIN
SET @Date = Null
END
RETURN (@Date)
END

However when I use the UDF it gives me the following error:

Server: Msg 542, Level 16, State 1, Procedure UDFn_CheckDate, Line 23
An invalid datetime value was encountered. Value exceeds the year 9999.

I have tried many variations of Convert, Cast etc. but still can't get it to work.

Anybody got any ideas???

View 8 Replies View Related

Weird SP Problem

Feb 17, 2006

Hello,

I'm now converting my queries from Access db to SQL Server db and I'm new with SP only.

I have a big query that is building from 1 or 2 sub-queries with "TOP x" (x is a variable in ASP).
SP can't be used with an outside variable for "SELECT TOP x.." so I tried to send the sub-query as a variable to the SP
but it refer it as a string and not a code so I can't run this sub-query in the SP.

Example:

CREATE PROCEDURE usp_test

@subSQL varchar(200)

AS

SELECT id FROM tbl WHERE id IN (@subSQL) ORDER BY id DESC

GO

----------------

exec usp_test 'SELECT TOP 15 id FROM tbl2'

What's wrong here? Am I working in a wrong method? :(

Thanks for the helpers,
BuildHome

View 3 Replies View Related

Weird Error

Dec 30, 2003

Heres some SQL I am trying to execute:

INSERT INTO Contact_Info (First,Last,Age) VALUES ('Alex','Strait',19)

Now it seems basic, but there in one more field that you're not supposed to specifiy a value in the SQL, its an int IDENTITY datatype field called num_id. Now this SQL works if it doesnt have the num_id field. But heres the error is gives me, I have never seen it before

Microsoft OLE DB Provider for ODBC Drivers error '80040e57'

[Microsoft][ODBC SQL Server Driver][SQL Server]String or binary data would be truncated.

/neosql.asp, line 847

Does anyone know what is wrong?

View 6 Replies View Related

Weird Behaivior

Jun 13, 2008

Hi

I have this stored procedure that works a little odd, some times it do what I want it to do which is....

- Insert orderinformation in tbl_Torderinfo table and then transfer all rows that are associated with a ordernumber from tbl_Ctemp to tbl_Torders

but sometimes it only insert data into the tbl_Orderinfo table and doesn't transfer the order details from tbl_Ctemp to tbl_TOrders even if there is rows to transfer. Any ideas of what might cause this odd behaivior?



p_AddOrder
@AdressID Int,
@UserID Int,
@UserRealName nVarChar(255),
@Comment nVarChar(4000),
@OurReference nvarchar(255),
@YourReference nvarchar(255),
@DeliveryAdress nvarchar(4000),
@Buyer nvarchar(4000),
@DeliverBy nvarchar(255),
@DestCountry nvarchar(255),
@FreightMark nvarchar(255),

AS
DECLARE @iOrderID Int
BEGIN
SET NOCOUNT ON;
INSERT INTO tbl_TOrderInfo
(
AdressID,
UserID,
UserRealName,
DateOrdered,
Comment,
OurReference,
YourReference,
DeliveryAdress,
Buyer,
DeliverBy,
DestCountry,
FreightMark,
OrderID
)
VALUES
(
@AdressID,
@UserID,
@UserRealName,
GETDATE(),
@Comment,
@OurReference,
@YourReference,
@DeliveryAdress,
@Buyer,
@DeliverBy,
@DestCountry,
@FreightMark,
@OrderID
)
SELECT @@IDENTITY
SET @iOrderID = @@IDENTITY

--Insert New ID and Info into Orders table
INSERT INTO tbl_TOrders (TOrderID,ProductName,OwnBID)

SELECT @iOrderID, Product, OwnBID FROM tbl_CTemp WHERE UID = @OrderID
END

View 20 Replies View Related

Weird SP Problem

Feb 17, 2006

Hello,

I'm now converting my queries from Access db to SQL Server db and I'm new with SP only.

I have a big query that is building from 1 or 2 sub-queries with "TOP x" (x is a variable in ASP).
SP can't be used with an outside variable for "SELECT TOP x.." so I tried to send the sub-query as a variable to the SP
but it refer it as a string and not a code so I can't run this sub-query in the SP.

Example:

CREATE PROCEDURE usp_test

@subSQL varchar(200)

AS

SELECT id FROM tbl WHERE id IN (@subSQL) ORDER BY id DESC

GO

----------------

exec usp_test 'SELECT TOP 15 id FROM tbl2'

What's wrong here? Am I working in a wrong method?

Thanks for the helpers,
BuildHome

View 5 Replies View Related

Weird DTS Problem

Aug 12, 2006

have a dts package that is run by a scheduled job which was runningsuccessfully for several months and suddenly stopped working.The dts package does the following: Truncates the table, does a datapump from a specific excel file to a table on sql server, deletes theexcel file. The job does the following:Step 1: Look to see if a file exists and if so, run the dts package. Onsuccess of this step the job goes to step 2.Step2: Looks to see if any files still exist after the first stepStep3: Failure notification. To be triggered on failure of step 1 or2.The owner of the job is the Account that is used to run theSQLServiceAgent and in the SysAdmin server role.The owner of the job is also in the SysAdmin server role.Both the accounts are Windows Accounts.The job runs at schedule time, finds the file, and runs the dtspackage. The first part of the dts package runs successfully - Thetable is cleared. However it is not doing the data pump part. Thereare no failure notifications. The job then goes to step two and sendsa message that the file still exists. The dts task is set to output anerror file which is not being updated, which tells that the task is notexecuted. If the dts package is run manually, then the package runssuccessfully.Any help would be appreciated.ThanksKR

View 2 Replies View Related

Weird Toolbar

Aug 31, 2006

I have just installed my server with server2003 enterprise edition, everything is working fine. However, after I make it online for awhile, I found a weird thing on the tool bar just beside the clock. There are 2 hidden icons, when I move the pointer to these 2 icons, it shows the IP address of my server. Just wanna know if there is anything wrong with that.

Thanks!

tom

View 6 Replies View Related

Weird BIT Behavior...

Aug 29, 2007

I'm seeing some strange behavior from a stored procedure of mine. It essentially grabs a bunch of rows using a fairly simple JOIN....here's the from statement:




Code Snippet
FROM Payment PY (NOLOCK)
JOIN (SELECT DISTINCT
PY.AccountPaymentId,
ROW_NUMBER() OVER(ORDER BY PY.AccountPaymentId ASC) AS RowNum
FROM Payment PY (NOLOCK)) AS SQ
ON (SQ.AccountPaymentId = PY.AccountPaymentId)
INNER JOIN Payee PE ON PE.PayeeId = PY.PayeeId INNER JOIN
Party PT ON PE.PartyId = PT.PartyId INNER JOIN
Distribution DS ON PY.DistributionId = DS.DistributionId LEFT OUTER JOIN
Account AC ON DS.AccountId = AC.AccountId INNER JOIN
clm CM ON PE.clm_no = cm.clm_no LEFT OUTER JOIN
PartyAddress PA ON PY.PartyAddressId = PA.PartyAddressId AND
PT.PartyId = PA.PartyId
WHERE RowNum BETWEEN (((@Page * @PageSize) - @PageSize) + 1) AND ((@Page * @PageSize) - @PageSize) + @PageSize
and ((@PayeeName IS NULL) OR (PT.[Name] LIKE '%' + @PayeeName + '%'))
AND ((@AccountId IS NULL) OR (AC.AccountId = @AccountId))
AND ((@DistributionId IS NULL) OR (DS.DistributionId = @DistributionId))
AND ((@PaymentDate IS NULL) OR (DATEADD(day, DATEDIFF(day, 0, PY.PaymentDate), 0) = DATEADD(day, DATEDIFF(day, 0, @PaymentDate), 0))) -- Ignores the time
AND ((@PaymentNumber IS NULL) OR (PY.AccountPaymentId = @PaymentNumber))
AND ((@IsReconciled IS NULL) OR (PY.ReconciledInd = @IsReconciled))
AND ((@AmountIssued IS NULL) OR (PY.PaymentAmount = @AmountIssued))
AND ((@AmountPaid IS NULL) OR (PY.AccountPaidAmount = @AmountPaid))
AND ((@IssueStatus IS NULL) OR (PY.PaymentStatusEnumItemId = @IssueStatus))
AND ((@AccountStatus IS NULL) OR (PY.AccountStatusEnumItemId = @AccountStatus))
AND ((@IsReissued IS NULL) OR (PY.ReissuedInd = @IsReissued))
ORDER BY AccountPaymentID ASC


When I pass a 1 for the @IsReconciled parameter, I get the right number of rows back - 9779. But when I pass a 0 (zero), i get no rows back, although there are 222 rows which satisfy the condition.

Is there somethig I'm overlooking (I don't think I am...)? I don't know whay 1 works and 0 wouldn't...

FYI - the @IsReconciled parameter is set to NULL at the outset of the procedure -

@IsReconciled Bit = Null

View 1 Replies View Related

HELP - Weird ADO Problem

Jan 30, 2008

Hi, I hope someone can help me with a weird problem I'm having. Towards the end of last week a number of users started reporting problems with one of our legacy applications. The application is written in VB6 connecting via ADO to a SQL 7 database. I managed to trace the error to a piece of inline SQL (shock!horror!) in a DLL that hasn't been changed since 2002, it occurs on the adodb recordset open and generates the error "could not complete cursor operation because the table schema changed after the cursor was declared" although nothing has changed on the database. It does not always happen, it depends on the contents of the strOrganisationIDs and the order of the numbers, although the same combination of numbers will generate the error every time! Initially there were certain users who were not having the error, but they have all gradually 'caught up'! There were some windows updates rolled out about the same time the errors started occuring, but un-installing them makes no difference. Here is a snippet of the code:-


Dim rsRecordSet As ADODB.Recordset
Dim strOrganisationIDs As String

strOrganisationIDs = "(111974,21986,0)"

strSQL = "SELECT o.organisation_id, o.name, o.town, o.county," & _
" o.country, o.key_customer, i.industry_sector," & _
"(SELECT Name FROM SODA_User WHERE User_Id = o.User_ID) as Name1," & _
"(SELECT Name FROM SODA_User WHERE User_ID = o.Assignee) AS Name2," & _
"o.registered_on_web " & _
" FROM Organisation o, Industry_Sector i WHERE o.Sector_ID = i.Sector_ID" & _
" AND Organisation_Id IN " & strOrganisationIDs & _
"ORDER BY o.Search_Name"
rsRecordset.open strSQL


I have managed to find a way around the error - I removed the spaces in front of the o.country, don't know why they were there, and they shouldn't cause the error - in fact they are there on the occasions it works, it seems to be the combination of spaces and certain numbers in the strOrganisationIDs . It sounds stupid and i've been pulling my hair out looking for a reason, as have several colleagues. I don't want to have to roll out the fix as it will be quite messy and affects a lot of users, although i may have to - but what I really want to know is why it has happened. I hope someone can shed some light on this, if any other info is required, let me know.

View 8 Replies View Related







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