Showing posts with label update. Show all posts
Showing posts with label update. Show all posts

Thursday, March 29, 2012

Error when updating

I get the following error when I execute the statement below. 'Invalid
length parameter passed to the substring function'
Update Tbl_Txn_UT
Set Fxd_Units =
CASE
WHEN TxnUnitsBase is Null and (TxnUnits like '%,%' or TxnUnits like
'%M%' and TxnUnitsDur like '%M%')
THEN Cast(left(TxnUnitsDur,len(TxnUnitsDur)-1)as Float)/15
WHEN TxnUnitsDur is Null and (TxnUnits like '%,%' or TxnUnits like
'%M%')
THEN TxnUnitsBase
WHEN (TxnUnits like '%,%' or TxnUnits like '%M%')
THEN Cast(left(TxnUnitsDur,len(TxnUnitsDur)-1)as Float)/15 +
TxnUnitsBase
Else TxnUnits
END
Where TxnUnits is not Null
It took a while to get this code correct with help and now evidently one of
the answers from the math causes an error. Any help is appreciated.Hi
Posting DDL an example data would help to see what you are trying to achive
and help re-create the problem. The statement is assuming that TxnUnitsDur i
s
at least one character which could is probably causing the problem.
John
"Job" wrote:

> I get the following error when I execute the statement below. 'Invalid
> length parameter passed to the substring function'
> Update Tbl_Txn_UT
> Set Fxd_Units =
> CASE
> WHEN TxnUnitsBase is Null and (TxnUnits like '%,%' or TxnUnits like
> '%M%' and TxnUnitsDur like '%M%')
> THEN Cast(left(TxnUnitsDur,len(TxnUnitsDur)-1)as Float)/15
> WHEN TxnUnitsDur is Null and (TxnUnits like '%,%' or TxnUnits like
> '%M%')
> THEN TxnUnitsBase
> WHEN (TxnUnits like '%,%' or TxnUnits like '%M%')
> THEN Cast(left(TxnUnitsDur,len(TxnUnitsDur)-1)as Float)/15 +
> TxnUnitsBase
> Else TxnUnits
> END
> Where TxnUnits is not Null
>
> It took a while to get this code correct with help and now evidently one o
f
> the answers from the math causes an error. Any help is appreciated.
>
>|||"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:B6369D9E-3B4A-4F9B-A443-13463C76635C@.microsoft.com...
> Hi
> Posting DDL an example data would help to see what you are trying to
> achive
> and help re-create the problem. The statement is assuming that TxnUnitsDur
> is
> at least one character which could is probably causing the problem.
> John
> "Job" wrote:
>|||Ju
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:B6369D9E-3B4A-4F9B-A443-13463C76635C@.microsoft.com...
> Hi
> Posting DDL an example data would help to see what you are trying to
> achive
> and help re-create the problem. The statement is assuming that TxnUnitsDur
> is
> at least one character which could is probably causing the problem.
> John
> "Job" wrote:
>|||Hi
You seem to have some problem posting?
John
"Job" <Job@.nomail.com> wrote in message
news:uUH$jpCoFHA.708@.TK2MSFTNGP09.phx.gbl...
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:B6369D9E-3B4A-4F9B-A443-13463C76635C@.microsoft.com...
>|||John, your correct. I included the case statement if len(TxnUnitsDur )
= 0 then TxnUnitsBase and it worked perfectly.
Cheers!
Job wrote:
> Ju
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:B6369D9E-3B4A-4F9B-A443-13463C76635C@.microsoft.com...
>
>
>

Error when trying to update

Hi All
I get this error when i open a specific table from enterprise manager and
try to update values in it.
Data has changed since the results pane was last updated. Do you want to
save your changes now?
Click Yes to save your chnages and update the database.
Click No to discard your changes and refresh the results pane.
Click Cancel to continue editing.
If i click Yes which is of course what i wnated to do from the begining i
get this error:
Row cannot be located for updating.Some values may have been changed since
it was last Read.
So i was wonderring if anybody can give me some help with that.
Thanks in Advance
Naderseems like someone else already made a change to your data or that you are
trying to make a change to a key value that is used by em to locate the
record you want to update
Regards,
Dandy Weyn
MCSE, MCSA, MCDBA, MCT
www.dandyman.net
"Nader Galal" <ngalal@.health-insights.com> wrote in message
news:uNxO%23CD1DHA.3224@.tk2msftngp13.phx.gbl...
quote:

> Hi All
> I get this error when i open a specific table from enterprise manager and
> try to update values in it.
> Data has changed since the results pane was last updated. Do you want to
> save your changes now?
> Click Yes to save your chnages and update the database.
> Click No to discard your changes and refresh the results pane.
> Click Cancel to continue editing.
> If i click Yes which is of course what i wnated to do from the begining i
> get this error:
> Row cannot be located for updating.Some values may have been changed since
> it was last Read.
> So i was wonderring if anybody can give me some help with that.
> Thanks in Advance
> Nader
>
sql

Monday, March 26, 2012

Error when perform an update on Immediate Updating Subscriber

I have transaction replication setup between two servers running SQL Server
2000 (standard edition). The subscriber is an immediate updating subscriber.
I am having an issue when I try to update two tables from the subscriber.
When I attempt to perform an update on either table, I receive an error like
the following:
Server: Msg 170, Level 15, State 1, Line 2
Line 2: Incorrect syntax near ')'.
Server: Msg 137, Level 15, State 1, Line 5
Must declare the variable '@.c120o'.
I looked at the syntax of the trg_MSsync_upd_<tablename> trigger and cannot
see any problem with the trigger's syntax.
Any help anyone can provide would be greatly appreciated.
Michael Conway
Calltower, Inc.
Database Administrator
Can you post the name and schema of your problem article?
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
"mconway" <mconway@.calltower.com.(donotspam)> wrote in message
news:33FA51A4-1FE7-494F-B992-20C644B3F0E2@.microsoft.com...
>I have transaction replication setup between two servers running SQL Server
> 2000 (standard edition). The subscriber is an immediate updating
> subscriber.
>
> I am having an issue when I try to update two tables from the subscriber.
> When I attempt to perform an update on either table, I receive an error
> like
> the following:
> Server: Msg 170, Level 15, State 1, Line 2
> Line 2: Incorrect syntax near ')'.
> Server: Msg 137, Level 15, State 1, Line 5
> Must declare the variable '@.c120o'.
> I looked at the syntax of the trg_MSsync_upd_<tablename> trigger and
> cannot
> see any problem with the trigger's syntax.
> Any help anyone can provide would be greatly appreciated.
>
> --
> Michael Conway
> Calltower, Inc.
> Database Administrator
|||I am having the issue with two articles so I am going to post the schema for
both tables. I am posting the schema as it is in production. There are
spaces in some of the column names, and at first I thought that this was the
cause of the problem, however I removed the spaces in the column names and
still received the same error.
CREATE TABLE [dbo].[Accounts] (
[ID] [int] IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL ,
[FName] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[LName] [nvarchar] (25) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[SSN] [nvarchar] (9) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Phone] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Phone2] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Phone3] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Street] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[City] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[State] [nvarchar] (2) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Zip] [nvarchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Email] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Status] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Grid] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Install Start Time] [int] NULL ,
[Install Duration] [int] NULL ,
[Sale Date] [smalldatetime] NULL ,
[Install Date] [smalldatetime] NULL ,
[Charge Back] [smalldatetime] NULL ,
[Who Entered] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[timeentered] [smalldatetime] NULL ,
[Lead Name] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Rep Name] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Tech Name] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Lead ID] [int] NULL ,
[Rep ID] [int] NULL ,
[Technician ID] [int] NULL ,
[Leadpaid] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Reppaid] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Techpaid] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Lead pay] [float] NULL ,
[Lead holdback] [float] NULL ,
[Lead bonus] [float] NULL ,
[Rep pay] [float] NULL ,
[Rep holdback] [float] NULL ,
[Rep bonus] [float] NULL ,
[Tech pay] [float] NULL ,
[Tech holdback] [float] NULL ,
[Tech bonus] [float] NULL ,
[AreaID] [int] NULL ,
[CC Number] [nvarchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Promotion] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Promotion ID] [int] NULL ,
[Kit ID] [int] NULL ,
[Shipping Vendor] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Tracking Number] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Certificate Number] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS
NULL ,
[Virtual Certificate] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS
NULL ,
[Wiring] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Channels] [nvarchar] (40) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Structure] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Story] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Roof] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Cable] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Home Type] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Ala Carte] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[General] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Local] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Payment Type] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Receivers] [tinyint] NULL ,
[Payment] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Account Number] [nvarchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[R001] [nvarchar] (9) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[R002] [nvarchar] (9) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[R003] [nvarchar] (9) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[R004] [nvarchar] (9) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Claim ID] [nvarchar] (11) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Owe] [float] NULL ,
[Tax] [float] NULL ,
[Collected] [float] NULL ,
[Autodebit] [tinyint] NULL ,
[Processed] [tinyint] NULL ,
[Submitted] [tinyint] NULL ,
[Paid] [tinyint] NULL ,
[Follow Up] [tinyint] NULL ,
[Processed Date] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Submitted Date] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Paid Date] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[collections] [tinyint] NULL ,
[campaignid] [int] NULL ,
[satelliteprovider] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS
NULL ,
[basepackageid] [int] NULL ,
[programmingquote] [float] NULL ,
[dishlocals] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[directlocals] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[numbertvs] [int] NULL ,
[subscriberid] [varchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[contactdate] [datetime] NULL ,
[progreceivers] [int] NULL ,
[progprovider] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[progpackage] [int] NULL ,
[progpromotionid] [int] NULL ,
[confirminstallation] [tinyint] NULL ,
[arrival] [datetime] NULL ,
[departure] [datetime] NULL ,
[arrivalcode] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[departurecode] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[R005] [varchar] (9) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[R006] [varchar] (9) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Promo Code] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[confirminstalldate] [datetime] NULL ,
[received] [tinyint] NULL ,
[receiveddate] [datetime] NULL ,
[cancelled] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Fullfillment] [tinyint] NULL ,
[UpgradeID] [int] NULL ,
[leadreceivers] [float] NULL ,
[repreceivers] [float] NULL ,
[techreceivers] [float] NULL ,
[techmaterials] [float] NULL ,
[leadequipment] [float] NULL ,
[repequipment] [float] NULL ,
[techequipment] [float] NULL ,
[chargebackpaid] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[claimupdated] [float] NULL ,
[claimupdateddate] [datetime] NULL ,
[ScheduleSlotID] [bigint] NULL ,
[Warranty] [tinyint] NULL ,
[PreviousProvider] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Gender] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Employer] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[DOB] [datetime] NULL ,
[ReferralID] [bigint] NULL ,
[ReferralName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Installed] [tinyint] NULL ,
[OldKitID] [bigint] NULL ,
[OldPromotionID] [bigint] NULL ,
[ClaimID2] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[OldUpgradeID] [bigint] NULL ,
[BoundType] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[street2] [varchar] (60) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[UpgradeOptions] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[DriversLicense] [varchar] (25) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[DLState] [varchar] (2) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[ChargebackReason] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[ConvertDate] [datetime] NULL ,
[ConverTempID] [bigint] NULL ,
[LastUpdate] [datetime] NULL ,
[LastUpdateEmpID] [bigint] NULL ,
[msrepl_tran_version] [uniqueidentifier] NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[Employee] (
[ID] [int] IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL ,
[FName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[LName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Phone] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Phone2] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Phone3] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Inactive] [smallint] NULL ,
[Lead Plan] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Rep Plan] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Tech Plan] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[user] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[password] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[expiration date] [smalldatetime] NULL ,
[street] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[city] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[zip] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[state] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[ssn] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[email] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Type] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Lead Rep] [tinyint] NULL ,
[Rep] [tinyint] NULL ,
[Tech] [tinyint] NULL ,
[links] [tinyint] NULL ,
[add] [tinyint] NULL ,
[update] [tinyint] NULL ,
[delete] [tinyint] NULL ,
[lookup] [tinyint] NULL ,
[scheduler] [tinyint] NULL ,
[accounts] [tinyint] NULL ,
[openticket] [tinyint] NULL ,
[openbilling] [tinyint] NULL ,
[leadcenter] [tinyint] NULL ,
[creditcard] [tinyint] NULL ,
[employee] [tinyint] NULL ,
[areas] [tinyint] NULL ,
[promotions] [tinyint] NULL ,
[promocodes] [tinyint] NULL ,
[makekits] [tinyint] NULL ,
[equipment] [tinyint] NULL ,
[payplans] [tinyint] NULL ,
[preferences] [tinyint] NULL ,
[commissions] [tinyint] NULL ,
[admin] [tinyint] NULL ,
[reports] [tinyint] NULL ,
[receivers] [tinyint] NULL ,
[export] [tinyint] NULL ,
[payments] [tinyint] NULL ,
[production] [tinyint] NULL ,
[route] [tinyint] NULL ,
[statistics] [tinyint] NULL ,
[status] [tinyint] NULL ,
[leadaccounts] [tinyint] NULL ,
[leadpayroll] [tinyint] NULL ,
[repaccounts] [tinyint] NULL ,
[reppayroll] [tinyint] NULL ,
[techpayroll] [tinyint] NULL ,
[techaccounts] [tinyint] NULL ,
[top] [tinyint] NULL ,
[installed] [tinyint] NULL ,
[pending] [tinyint] NULL ,
[cancelled] [tinyint] NULL ,
[chargeback] [tinyint] NULL ,
[reconciliation] [tinyint] NULL ,
[accounting] [tinyint] NULL ,
[receiveables] [tinyint] NULL ,
[reserviced] [tinyint] NULL ,
[rescheduled] [tinyint] NULL ,
[notscheduled] [tinyint] NULL ,
[channels] [tinyint] NULL ,
[churn] [tinyint] NULL ,
[r00] [tinyint] NULL ,
[missing payments] [tinyint] NULL ,
[deactivations] [tinyint] NULL ,
[disconnects] [tinyint] NULL ,
[salestax] [tinyint] NULL ,
[residuals] [tinyint] NULL ,
[exceptions] [tinyint] NULL ,
[servicecalls] [tinyint] NULL ,
[ra] [tinyint] NULL ,
[individualstatistics] [tinyint] NULL ,
[allstatus] [tinyint] NULL ,
[process] [tinyint] NULL ,
[campaigns] [tinyint] NULL ,
[adcampaignreport] [tinyint] NULL ,
[equipmentsalesreport] [tinyint] NULL ,
[missingcertsreport] [tinyint] NULL ,
[undepositedfunds] [tinyint] NULL ,
[Inventory] [tinyint] NULL ,
[TechArriveDepart] [tinyint] NULL ,
[TechInventoryReport] [tinyint] NULL ,
[btnR00] [tinyint] NULL ,
[btnNotes] [tinyint] NULL ,
[btnInvoices] [tinyint] NULL ,
[btnProgramming] [tinyint] NULL ,
[btnReceivables] [tinyint] NULL ,
[btnCreditCard] [tinyint] NULL ,
[btnBankInfo] [tinyint] NULL ,
[btnBilling] [tinyint] NULL ,
[btnContract] [tinyint] NULL ,
[btnService] [tinyint] NULL ,
[btnQuote] [tinyint] NULL ,
[quickbooks] [tinyint] NULL ,
[dataexport] [tinyint] NULL ,
[dataimport] [tinyint] NULL ,
[fake1] [tinyint] NULL ,
[fake2] [tinyint] NULL ,
[fake3] [tinyint] NULL ,
[fake4] [tinyint] NULL ,
[hours] [tinyint] NULL ,
[payrolladministrator] [tinyint] NULL ,
[servicepay] [float] NULL ,
[timeoff] [tinyint] NULL ,
[installation] [tinyint] NULL ,
[negativecommissions] [tinyint] NULL ,
[collections] [tinyint] NULL ,
[WarrantySalesReport] [tinyint] NULL ,
[EmployeeSalesReport] [tinyint] NULL ,
[CommissionsReport] [tinyint] NULL ,
[UserType] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[TextMessage] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[btnCreditCardView] [tinyint] NULL ,
[btnMoveToLead] [tinyint] NULL ,
[btnManualSchedule] [tinyint] NULL ,
[CancelledReasonReport] [tinyint] NULL ,
[ReferralsReport] [tinyint] NULL ,
[callbacknotes] [tinyint] NULL ,
[toptechs] [tinyint] NULL ,
[LeadLedger] [tinyint] NULL ,
[RepLedger] [tinyint] NULL ,
[TechLedger] [tinyint] NULL ,
[Forecasting] [tinyint] NULL ,
[UserLogin] [tinyint] NULL ,
[POs] [tinyint] NULL ,
[AddEquipment] [tinyint] NULL ,
[EquipmentInventory] [tinyint] NULL ,
[AdjustInventory] [tinyint] NULL ,
[EquipmentLookup] [tinyint] NULL ,
[Aging] [tinyint] NULL ,
[DishCode] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[DirectCode] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[SalesByVendor] [tinyint] NULL ,
[InstalledReceivers] [tinyint] NULL ,
[TopOffice] [tinyint] NULL ,
[RepInvoices] [tinyint] NULL ,
[msrepl_tran_version] [uniqueidentifier] NOT NULL
) ON [PRIMARY]
"Hilary Cotter" wrote:

> Can you post the name and schema of your problem article?
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> "mconway" <mconway@.calltower.com.(donotspam)> wrote in message
> news:33FA51A4-1FE7-494F-B992-20C644B3F0E2@.microsoft.com...
>
>
|||I tried unsubscribing to the publication. Then I removed any spaces in the
column names and changed any column names that were using reserved words.
Then I recreated the subscription and subscriber database. However, I still
received the same errors when I tried to update the two tables.
"Hilary Cotter" wrote:

> Can you post the name and schema of your problem article?
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> "mconway" <mconway@.calltower.com.(donotspam)> wrote in message
> news:33FA51A4-1FE7-494F-B992-20C644B3F0E2@.microsoft.com...
>
>

Wednesday, March 21, 2012

error when I run script

Hi All,

I can't not run the query to update data but it raice an error as below:

"Server: Msg 1101, Level 17, State 10, Line 1
Could not allocate new page for database 'TEMPDB'. There are no more pages available in filegroup DEFAULT. Space can be created by dropping objects, adding additional files, or allowing file growth."

HDD free space: 5GB
RAM: 1GB
CPU: 2.8MHz

What should I do?
Please advice me on this.

Thanks in advance,
TNLooks like your TempDb is running out of space.

Are you the database administrator?

The Fonzi approach (not reccomended) would be to restart the SQL Server Service on the server because the tempdb is recreated each time SQL Server is restarted.

In the Enterprise Manager you can right click on the tempdb and check the file growth propeties and adjust them as necessary.

Finally, I wonder what your query might be doing to fill up the tempdb. Do you want to post your script or tell us what you are trying to do?

Wednesday, March 7, 2012

Error using UPDATE statement

Hi,

I am relatively new to SQL. I am using SQL 2000. I am trying to
Update a field base in a criteria in a scond table.

UPDATE Tbl1
SET Tbl1.Row2 = '1'
WHERE Tbl1.Row1 =
(SELECT Tbl1.Row1
FROM Tbl2, Tbl1
WHERE Tbl2.Row1 = Tbl1.Row1 AND ({ fn
CURRENT_TIMESTAMP () } >= Tbl2.Row3))

Row 1 is the key between the two table. If I am doing only the select
below, I am getting the right value.

SELECT Tbl1.Row1
FROM Tbl2, Tbl1
WHERE Tbl2.Row1 = Tbl1.Row1 AND ({ fn
CURRENT_TIMESTAMP () } >= Tbl2.Row3)

When I am running the entire querry, I am getting this error:

Subquery returned more than 1 value. This is not permitted when the
subquery follows =, !=, <, <= , >, >= or when the subquery is used as
an expression.
The statement has been terminated.

What I am trying to do is to update a field in Tbl1 base on a date in
Tbl2. If the date is expire, I want to raise a flag, in Tbl1.

Thank you

PhilippeOn 27 Feb 2006 12:22:26 -0800, solidsna2@.gmail.com wrote:

>Hi,
>I am relatively new to SQL. I am using SQL 2000. I am trying to
>Update a field base in a criteria in a scond table.
>UPDATE Tbl1
>SET Tbl1.Row2 = '1'
>WHERE Tbl1.Row1 =
> (SELECT Tbl1.Row1
> FROM Tbl2, Tbl1
> WHERE Tbl2.Row1 = Tbl1.Row1 AND ({ fn
>CURRENT_TIMESTAMP () } >= Tbl2.Row3))
>Row 1 is the key between the two table. If I am doing only the select
>below, I am getting the right value.
>SELECT Tbl1.Row1
> FROM Tbl2, Tbl1
> WHERE Tbl2.Row1 = Tbl1.Row1 AND ({ fn
>CURRENT_TIMESTAMP () } >= Tbl2.Row3)
>When I am running the entire querry, I am getting this error:
>Subquery returned more than 1 value. This is not permitted when the
>subquery follows =, !=, <, <= , >, >= or when the subquery is used as
>an expression.
>The statement has been terminated.
>What I am trying to do is to update a field in Tbl1 base on a date in
>Tbl2. If the date is expire, I want to raise a flag, in Tbl1.
>Thank you
>Philippe

Hi Philippe,

Hard to be sure without CREATE TABLE statements, INSERT statements and
expected output (see www.aspfaq.com/5006), but I guess that you need
something like this:

UPDATE Tbl1
SET Row2 = '1'
WHERE EXISTS
(SELECT *
FROM Tbl2
WHERE Tbl2.Row3 >= CURRENT_TIMESTAMP
AND Tbl2.Row1 = Tbl1.Row1)

--
Hugo Kornelis, SQL Server MVP|||(solidsna2@.gmail.com) writes:
> I am relatively new to SQL. I am using SQL 2000. I am trying to
> Update a field base in a criteria in a scond table.
> UPDATE Tbl1
> SET Tbl1.Row2 = '1'
> WHERE Tbl1.Row1 =
> (SELECT Tbl1.Row1
> FROM Tbl2, Tbl1
> WHERE Tbl2.Row1 = Tbl1.Row1 AND ({ fn
> CURRENT_TIMESTAMP () } >= Tbl2.Row3))

This does not look right. You have Tbl1 once extra in the subquery,
making it entirely uncorrelated with the outer Tbl1. Try chaning the
query to:

UPDATE Tbl1
SET Row2 = '1'
WHERE Tbl1.Row1 = (SELECT Tbl2.Row1
FROM Tbl2
WHERE Tbl2.Row1 = Tbl1.Row1
AND CURRENT_TIMESTAMP >= Tbl2.Row3)

I also changed {fn current_timestamp() } as there is no reason to
call an ODBC function to get the current date.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Thank you for the reply. Sadly, I am getting the same error with your
solution. If I run only the SELECT subquery alone, I am getting
mutiple result, and the result are what I am expecting. In Tbl2, Row1
can be the same for up to 8 lines. Row1 is the key between the 2
tables. In Tbl1, Row1 is unique.

Ex:
ROW1 ROW2 ROW3
1 xxx zzz
1 aaa bbb
1 ccc ddd
1 eee fff
1 ggg hhh

Maybe this is why it is giving me the error that I have mutiple value.
Like I sayd, I am a new to doing SQL programming. Maybe I am missing
something or I do not approach the problem properly.

Thank you again|||Well I figure out the problem. I had a GROUP BY at the end of the
SELECT subquery.

UPDATE Tbl1
SET Row2 = '1'
WHERE Tbl1.Row1 = (SELECT Tbl2.Row1
FROM Tbl2
WHERE Tbl2.Row1 = Tbl1.Row1
AND CURRENT_TIMESTAMP >= Tbl2.Row3 GROUP BY
Tbl2.Row1)

Thank you again for your help.

Sunday, February 26, 2012

Error updating dynamic datagrid with SQL server

Hello, I have a datagrid which is populated with data from an MS SQL server database.

When I run an update query it always throws an exception - what is the most likely cause for this given that I am using the code below:

1public void DataGrid_Update(Object sender, DataGridCommandEventArgs e)2 {3 String update ="UPDATE Fruit SET Product = @.ID, Quantity = @.Q, Price = @.P, Total = @.T where Product = @.Id";45 SqlCommand command =new SqlCommand(update, conn);67command.Parameters.Add(new SqlParameter("@.ID", SqlDbType.NVarChar, 50));8 command.Parameters.Add(new SqlParameter("@.Q", SqlDbType.NVarChar, 50));9 command.Parameters.Add(new SqlParameter("@.P", SqlDbType.NVarChar, 50));10 command.Parameters.Add(new SqlParameter("@.T", SqlDbType.NVarChar, 50));11 command.Parameters["@.ID"].Value = DataGrid.DataKeys[(int)e.Item.ItemIndex];12 command.Connection.Open();1314try15 {16 command.ExecuteNonQuery();17 Message.InnerHtml ="Update complete!" + update;18 DataGrid.EditItemIndex = -1;19 }20catch (SqlException exc)21 {22 Message.InnerHtml ="Update error.";23 }2425 command.Connection.Close();2627 BindGrid();28 }

All of the row types in MS SQL server are set to nvarchar(50) - as I thought this would eliminate any inconsistencies in types.

Thanks anyone

Hi,

Can you show us the error message which can help us to solve the problem.

Thanks.

|||

Sorry if this does not make sense although I printed the SQL exception to screen.

I also changed my code a bit as I needed to change the look of the website therefore the error line number has changed to 65.

Updateerror.System.Data.SqlClient.SqlException: The parameterized query '(@.IDnvarchar(50),@.Q nvarchar(50),@.P nvarchar(50),@.T nvarchar(50' expectsthe parameter '@.Q', which was not supplied. atSystem.Data.SqlClient.SqlConnection.OnError(SqlException exception,Boolean breakConnection) atSystem.Data.SqlClient.SqlInternalConnection.OnError(SqlExceptionexception, Boolean breakConnection) atSystem.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObjectstateObj) at System.Data.SqlClient.TdsParser.Run(RunBehaviorrunBehavior, SqlCommand cmdHandler, SqlDataReader dataStream,BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReaderds, RunBehavior runBehavior, String resetOptionsString) atSystem.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehaviorcmdBehavior, RunBehavior runBehavior, Boolean returnStream, Booleanasync) atSystem.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehaviorcmdBehavior, RunBehavior runBehavior, Boolean returnStream, Stringmethod, DbAsyncResult result) atSystem.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResultresult, String methodName, Boolean sendToPipe) atSystem.Data.SqlClient.SqlCommand.ExecuteNonQuery() atASP.asp_aspx.MyDataGrid_Update(Object sender, DataGridCommandEventArgse) in c:\Inetpub\wwwroot\asp.aspx:line 65

Cheers

|||

Hi,

From the error message, i think the situation is that the parameters isn't supplied to the sql statement correctly. You can insert a breakpoint in "command.ExecuteNonQuery();" and check the local variable such as @.ID, @.Q, @.P and update statement. You can find out which parameters is not working properly.

Hope that helps. Thanks.

|||

How would I insert a breakpoint in "command.ExecuteNonQuery();". I guess just "break;" just after the statement - but would that give any more error output. Please suggest how I should do this.

Cheers

|||

Hi,

What I mean is one kind of debug tool. Just move your mouse to ""command.ExecuteNonQuery();" sentence and right click, a menu will be shown and find breakpoint and click on "Insert BreakPoint". And then run your applicaiton, it will interuppt while running to the breakpoint, and then, in the below window of your Visual Studio, you'll find a Local tab, under the tab, you can see all the current value of local variable, just check these to find if each parameters do have provided the input value properly.

Thanks.

Error Updating DB2 on MVS-MF from a Linked Server

Need to be able to run update queries on DB2 on IBM MF from a Linked Server. Select and Insert queries work but Update and Delete queries don't. DB2 connect is installed and ODBC System dsn's are created for DEV and Production DB2 environments.

The ODBC drivers can be selected when running Imports/Exports but can't be specified through a linked server.

Any Ideas?

Tom...

Linked Servers do not directly support ODBC drivers, but you can plug in ODBC drivers by using a OLE DB to ODBC bridge technology 'Microsoft OLE DB Provider for ODBC (MSDASQL)'. This componentships with MDAC but is not available on 64-bit at this time.

Although option would be to use Microsoft's DB2 OLE DB Provider directly with Linked Server available for download on http://www.microsoft.com/downloads/details.aspx?FamilyId=50b97994-8453-4998-8226-fa42ec403d17&DisplayLang=en

Microsoft OLEDB Provider for DB2

The Microsoft OLE DB Provider for DB2 is a COM component for integrating vital data stored in IBM DB2 databases with new solutions based on Microsoft SQL Server 2005 Enterprise Edition and Developer Edition. SQL Server developers and administrators can use the provider with Integration Services, Analysis Services, Replication, Reporting Services, and Distributed Query Processor. Run the self-extracting download package to create an installation folder. The single setup program will install the provider and tools on x86, x64, and IA64 computers. The package includes product updates in the form of an integrated Service Pack 1. Read the installation guide and Readme for more information.

Error Update

Hi,
I create the View which consist of multiple same table. When I want to update via the View, it doesn't allow me to update it, it gave out the following message,
View or function 'Table1' is not updatable because the modification affects multiple base tables.What do you mean by "multiple same table"? If you're saying the view has self-joins, then the view is not going to be updatable.