Wierd Update Statement Behaviour

Oct 11, 2001

Hi all,
I'm having a real wierd problem with sql 7.0 (sp3)update statement.
here is my table structure
sku varchar(18)
minimumquantity varchar(7)
maximumquantity varchar(7)
usa varchar(20)

when I issue an update like this...

update sapproductprices
set usa= "8.25"
from sapproductprices s
where (s.sku= "VSE-ASAP-BB-100-S1")

it works!, but, when I change my update to this it does'nt work...I get a message which says "the command completed successfully" and no update happens

update sapproductprices
set usa= "8.25"
from sapproductprices s
where (s.sku= "VSE-ASAP-BB-100-S1"
and s.maximumquantity ="10")

Can someone shed some light on this one please...
thanks
uday

View 3 Replies


ADVERTISEMENT

Wierd Update Statement Behaviour

Oct 11, 2001

Hi all,
I'm having a real wierd problem with sql 7.0 (sp3)update statement.
here is my table structure
sku varchar(18)
minimumquantity varchar(7)
maximumquantity varchar(7)
usa varchar(20)

when I issue an update like this...

update sapproductprices
set usa= "8.25"
from sapproductprices s
where (s.sku= "VSE-ASAP-BB-100-S1")

it works!, but, when I change my update to this it does'nt work...I get a message which says "the command completed successfully" and no update happens

update sapproductprices
set usa= "8.25"
from sapproductprices s
where (s.sku= "VSE-ASAP-BB-100-S1"
and s.maximumquantity ="10")

Can someone shed some light on this one please...
thanks
uday

View 2 Replies View Related

Wierd Select Statement, Possible?

Sep 25, 2007

Ill try describe this as best I can, because this isnt something that would be done usually, I think.

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

SELECT Items

FROM tblFood

WHERE Type = "Fruit"

RETURN

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


This would return...

Items
-----------
Apple
Orange
Pear
Strawberry

etc...


Would there be a way to create a new Column for each Item of the Select? eg..

Col1------Col2---------Col3----------Col4
Apple--Orange------Pear-----Strawberry

The amount of columns needs to be dynamic. If i were to add pineapple there needs to be 5 columns etc.
Sorry if this has been covered before but I wasnt sure on search criteria. Thanks in advance.

View 8 Replies View Related

Strange Behaviour In ORDER BY Statement

Jul 20, 2005

HiI've done a search and found plenty on ORDER BY problems, but mineshopefully a syntax error.This is a test segment from my stored procedure.DECLARE @Name varchar(50), @SortType IntSET @Name = "canal lock"SET @SortType = 8SELECT dbo.ite_Item.ite_IDFROM dbo.ite_Item LEFT OUTER JOINdbo.iti_ItemImages ONdbo.ite_Item.ite_ID = dbo.iti_ItemImages.iti_LinkToItemWHERE iti_ItemImages.iti_LinkToPhotoType=1AND ite_Name LIKE '%' + @Name + '%'ORDER BYCASEWHEN @SortType = 3 THEN dbo.ite_Item.ite_DateWHEN @SortType = 5 THEN dbo.ite_Item.ite_ViewsWHEN @SortType = 7 THEN dbo.ite_Item.ite_DescriptionEND ASC,CASEWHEN @SortType = 2 THEN dbo.ite_Item.ite_NameWHEN @SortType = 4 THEN dbo.ite_Item.ite_DateWHEN @SortType = 6 THEN dbo.ite_Item.ite_ViewsWHEN @SortType = 8 THEN dbo.ite_Item.ite_DescriptionEND DESC,CASEWHEN @SortType <> 2 THEN dbo.ite_Item.ite_NameEND ASCI get various errors:@SortType = 2. This is a Name field varchar(50)Syntax error converting the varchar value 'Canal Lock' to a column ofdata type smallint.I only have one smallint col and that is the ite_Views column. Why isit trying to convert a varchar(50) col?@SortType = 3. This is a ISO date field nchar(8)The conversion of the nvarchar value '20030909' overflowed an INT2column. Use a larger integer column.Why?@SortType = 7, 8. These are description fields varchar(5000)Syntax error converting the varchar value '<snip>' to a column of datatype smallint.Again, why?All other sort types are fine.What I'm thinking is that when the ORDER BY code is run, it does someconversion but what?Many thanks in advance if anyone has any ideas?Sam

View 3 Replies View Related

Strange Behaviour Of UPDATE STATISTICS.

Dec 10, 2007

Hi all ,

We had a SQL server (2005) that was performing very bad . We thought of doing an UPDATE STATISTICS thinking that the response times would increase.

BUT , UNFORTUNATELY THE SERVER PERFORMANCE BECAME WORSE FROM BAD.

Ex : Stored procedures that took 2 minutes are running for 22 minutes now. Queris that ran for 17 seconds are running for 14 minutes now.

Anybody faced this kind of issue earlier ? Any help would be appreciated.

Thanks & Regards,

DBLearner

View 2 Replies View Related

Multiple Tables Used In Select Statement Makes My Update Statement Not Work?

Aug 29, 2006

I am currently having this problem with gridview and detailview. When I drag either onto the page and set my select statement to pick from one table and then update that data through the gridview (lets say), the update works perfectly.  My problem is that the table I am pulling data from is mainly foreign keys.  So in order to hide the number values of the foreign keys, I select the string value columns from the tables that contain the primary keys.  I then use INNER JOIN in my SELECT so that I only get the data that pertains to the user I am looking to list and edit.  I run the "test query" and everything I need shows up as I want it.  I then go back to the gridview and change the fields which are foreign keys to templates.  When I edit the templates I bind the field that contains the string value of the given foreign key to the template.  This works great, because now the user will see string representation instead of the ID numbers that coinside with the string value.  So I run my webpage and everything show up as I want it to, all the data is correct and I get no errors.  I then click edit (as I have checked the "enable editing" box) and the gridview changes to edit mode.  I make my changes and then select "update."  When the page refreshes, and the gridview returns, the data is not updated and the original data is shown. I am sorry for so much typing, but I want to be as clear as possible with what I am doing.  The only thing I can see being the issue is that when I setup my SELECT and FROM to contain fields from multiple tables, the UPDATE then does not work.  When I remove all of my JOIN's and go back to foreign keys and one table the update works again.  Below is what I have for my SQL statements:------------------------------------------------------------------------------------------------------------------------------------- SELECT:SELECT People.FirstName, People.LastName, People.FullName, People.PropertyID, People.InviteTypeID, People.RSVP, People.Wheelchair, Property.[House/Day Hab], InviteType.InviteTypeName FROM (InviteType INNER JOIN (Property INNER JOIN People ON Property.PropertyID = People.PropertyID) ON InviteType.InviteTypeID = People.InviteTypeID) WHERE (People.PersonID = ?)UPDATE:UPDATE [People] SET [FirstName] = ?, [LastName] = ?, [FullName] = ?, [PropertyID] = ?, [InviteTypeID] = ?, [RSVP] = ?, [Wheelchair] = ? WHERE [PersonID] = ? ---------------------------------------------------------------------------------------------------------------------------------------The only fields I want to update are in [People].  My WHERE is based on a control that I use to select a person from a drop down list.  If I run the test query for the update while setting up my data source the query will update the record in the database.  It is when I try to make the update from the gridview that the data is not changed.  If anything is not clear please let me know and I will clarify as much as I can.  This is my first project using ASP and working with databases so I am completely learning as I go.  I took some database courses in college but I have never interacted with them with a web based front end.  Any help will be greatly appreciated.Thank you in advance for any time, help, and/or advice you can give.Brian 

View 5 Replies View Related

SQL Server 2012 :: Create Dynamic Update Statement Based On Return Values In Select Statement

Jan 9, 2015

Ok I have a query "SELECT ColumnNames FROM tbl1" let's say the values returned are "age,sex,race".

Now I want to be able to create an "update" statement like "UPATE tbl2 SET Col2 = age + sex + race" dynamically and execute this UPDATE statement. So, if the next select statement returns "age, sex, race, gender" then the script should create "UPDATE tbl2 SET Col2 = age + sex + race + gender" and execute it.

View 4 Replies View Related

SQL Server 2012 :: Update Statement With CASE Statement?

Aug 13, 2014

i was tasked to created an UPDATE statement for 6 tables , i would like to update 4 columns within the 6 tables , they all contains the same column names. the table gets its information from the source table, however the data that is transferd to the 6 tables are sometimes incorrect , i need to write a UPDATE statement that will automatically correct the data. the Update statement should also contact a where clause

the columns are [No] , [Salesperson Code], [Country Code] and [Country Name]

i was thinking of doing

Update [tablename]
SET [No] =
CASE
WHEN [No] ='AF01' THEN 'Country Code' = 'ZA7' AND 'Country Name' = 'South Africa'
ELSE 'Null'
END

What is the best way to script this

View 1 Replies View Related

Transact SQL :: Update Statement In Select Case Statement

May 5, 2015

I am attempting to run update statements within a SELECT CASE statement.

Select case x.field
WHEN 'XXX' THEN
  UPDATE TABLE1
   SET TABLE1.FIELD2 = 1
  ELSE
   UPDATE TABLE2
   SET TABLE2.FIELD1 = 2
END
FROM OuterTable x

I get incorrect syntax near the keyword 'update'.

View 7 Replies View Related

UPDATE SQL Statement In Excel VBA Editor To Update Access Database - ADO - SQL

Jul 23, 2005

Hello,I am trying to update records in my database from excel data using vbaeditor within excel.In order to launch a query, I use SQL langage in ADO as follwing:------------------------------------------------------------Dim adoConn As ADODB.ConnectionDim adoRs As ADODB.RecordsetDim sConn As StringDim sSql As StringDim sOutput As StringsConn = "DSN=MS Access Database;" & _"DBQ=MyDatabasePath;" & _"DefaultDir=MyPathDirectory;" & _"DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;" &_"PWD=xxxxxx;UID=admin;"ID, A, B C.. are my table fieldssSql = "SELECT ID, `A`, B, `C being a date`, D, E, `F`, `H`, I, J,`K`, L" & _" FROM MyTblName" & _" WHERE (`A`='MyA')" & _" AND (`C`>{ts '" & Format(Date, "yyyy-mm-dd hh:mm:ss") & "'})"& _" ORDER BY `C` DESC"Set adoConn = New ADODB.ConnectionadoConn.Open sConnSet adoRs = New ADODB.RecordsetadoRs.Open Source:=sSql, _ActiveConnection:=adoConnadoRs.MoveFirstSheets("Sheet1").Range("a2").CopyFromRecordset adoRsSet adoRs = NothingSet adoConn = Nothing---------------------------------------------------------------Does Anyone know How I can use the UPDATE, DELETE INSERT SQL statementsin this environement? Copying SQL statements from access does not workas I would have to reference Access Object in my project which I do notwant if I can avoid. Ideally I would like to use only ADO system andSQL approach.Thank you very muchNono

View 1 Replies View Related

JDBC 2005 Update Statement - Failing Multi Row Update.

Nov 9, 2007

It appears to update only the first qualifying row. The trace shows a row count of one when there are multiple qualifying rows in the table. This problem does not exist in JDBC 2000.

View 5 Replies View Related

Update Trigger Behaviour W/o A Trigger.

May 30, 2008

Hi,
I am not sure if this is the right forum to post this question.
I run an update statement like "Update mytable set status='S' " on the SQL 2005 management Studio.
When I run "select * from mytable" for a few seconds all status = "S". After a few seconds all status turn to "H".
This is a behaviour when you have an update trigger for the table. But I don't see any triggers under this table.
What else would cause the database automatically change my update?
Could there be any other place I should look for an update trigger on this table?
Thanks,

View 3 Replies View Related

Stored Procedure - Update Statement Does Not Seem To Update Straight Away

Jul 30, 2007

Hello,

I'm writing a fairly involved stored procedure. In this Stored Procedure, I have an update statement, followed by a select statement. The results of the select statement should be effected by the previous update statement, but its not. When the stored procedure is finish, the update statement seemed to have worked though, so it is working.

I suspect I need something, like a GO statement, but that doesnt seem to work for a stored procedure. Can anyone offer some assistance?

View 6 Replies View Related

Wierd Error...

Sep 21, 2000

Hi all,
I was trying to run this query

strSQL = "select '<input type=text name='& id &'size=4 maxlength=4 value=>',product,description,moreinfo,media,License,unitc ost from newdeal where category='" & session("category") & "'"

Idea is the value of id to be fetched from the DB and substituted in the input box.It works well with MS Access but in SqlServer it is showing an error saying that data of varchar type cannot be converted to *******.Id is ******* data type in the DB .can anyone help me please

Thanks
Shyam

View 2 Replies View Related

Wierd Query

Dec 6, 2004

I'm writing a report for a survey application. There is a subscriber table, a question table, and an answer table. The subscriber table holds info like the name, address, etc of the publication's subscribers. The Question table holds the questions on the survey (ie, How many widgets do you own? What is your age? How many do you think you will purchase in the coming year?). The Answer table holds answers to each question (18-21, 25-50%, 20+, etc). I am forced to work within a very non-standard database application running on MS SQL Server 2000 that also uses a separate Relationships table, so to determine which answers go with which questions the relationships table will have a record linking a question to an answer (and vice versa). To determine how each subscriber answered the question the subscibers have a record in the relationships table linking them with specific answers (and vice versa). Both types of entries are in the same table. There are several questions that will include a note to "check all that apply" (you may get several widgets from the company). The report runs through each question, shows how many subscribers answered the question, and how many selected each answer as a percentage of the total for that question. It is nearly finished, I can run it on the test data for any date, but there is one special case I'm having trouble with. For one question, they want to know additionally how many people chose one possible answer, but no others. I can do it using simple SQL to get the list of the subscribers that chose the answer in question, and then loop through each one in vb and run another query that will tell me how many answers related to that question they selected. This works okay for the test data, but in production there are more than 100,000 subscribers, which means running 100.000+ individual querys. I know it's possible to do this in one (all I want is the final count), but the SQL for this is horrid. Any help appreciated.

View 3 Replies View Related

Wierd Result Set Problem

May 2, 2007

Hi all,

We have an asp.net2 website pointing at sql2005 (not service packed yet - it may be the cause, not sure - would like opinions first!).The website will run without problems, but randomly we get the following scenario:We have a function that takes a SP name and a sqlcommand with parameter information.  It opens a connection and uses a dataadapter to fill a datatable, then closes the connection and returns.  When the problem occurs, we get a sqltimeout on the line where it tries to fill the datatable.  However, when the function is called again, the results from the first query seem to get populated into the datatable.  Then when it gets called again, the previous results are again returned.  Its like ADO sees the timeout (but sql doesn't), but then picks up the next available resultset from sql (which is the wrong one!).Hope the above makes sense....Cheers,James. 

View 5 Replies View Related

Wierd Bug With Sqlserver 2000

Apr 16, 2006

hey ppl, if there is any1 that can help me here i would apreciateerror line(probably)Comando = New SqlCommand("INSERT INTO Table1(name) VALUES('a')", Conexao)on Table1 i have those fieldsid(int, identity) e name(text)but when i execute this code i get the following error:Error on the XML processing: no element found(ps. the error wasnt on english so i made a poor translation but i think u can have a general ideia)(the error message untranslated)Erro no processamento de XML: nenhum elemento encontradoPosição: http://localhost/teste.aspxNúmero da linha 1, Coluna 1:anyway, the wierd part is that on the sqlserver the data is insertted normally.. so.. what is that error??any1 pls help me! im going nuts (ps. im still noob on asp.net/sqlserver so please be gentle ^.^)(ps2. sorry for the crap english but it isnt my native language :) )

View 3 Replies View Related

Wierd Results With != Operator

May 19, 2006

Hi all,

I have a table - customer with a Column state_code varchar(5) and another valid( smallint)

select count(1)

from customer

where state_code != 'U' -- for unknown

and valid= 0 -- for valid

Returns different counts each time, even when the data in the table is NOT Changing.



something with != operator ?



Thanks for your help !

Sri

View 5 Replies View Related

SQL Server 2012 :: Update Statement Will Not Update Data Beyond 7 Million Plus Rows Out Of 38 Millions Rows

Dec 12, 2014

I run the following statement and it will not update beyond 7 million plus rows and I have about 38 million to complete. I keep checking updated row counts and after 1/2 day it's still the same so I know something is wrong because it was rolling through no problem when I initiated it. I need to complete ASAP so it's adding to my frustration. The 'Acct_Num_CH' field is an encrypted field (fyi).

SET rowcount 10000
UPDATE [dbo].[CC_Info_T]
SET [Acct_Num_CH] = 'ayIWt6C8sgimC6t61EJ9d8BB3+bfIZ8v'
WHERE [Acct_Num_CH] IS NOT NULL
WHILE @@ROWCOUNT > 0
BEGIN
SET rowcount 10000
UPDATE [dbo].[CC_Info_T]
SET [Acct_Num_CH] = 'ayIWt6C8sgimC6t61EJ9d8BB3+bfIZ8v'
WHERE [Acct_Num_CH] IS NOT NULL
END
SET rowcount 0

View 5 Replies View Related

Wierd Problem With Enterprise Manager

Jul 20, 2005

Hi,I can not find any reference or support for the following issue fromMicrosoft or on Google:When I open a table either to return data or try to use the design tools orif I try to create a new database diagram, I get a new result pane, diagrampane etc... but no result and no functionality within that pane. Thedatabase is working and I can run querys using MS Query. The problem seemsto be with MMC or Enterprise Manager.I am using SQL Server 7.623 Service Patch Level 4 or 6. I am not sure onthat point. This has been a stable well functioning system for years withno recent changes. So I am sure it is not a configuration issue.Thanks in advance for your help.PS; I don't want to seem rude, but I am not interested in buying a new"upgrade" to fix this so any MS adbots out there can just not bother withresponding to this post :)

View 1 Replies View Related

SSIS ExecuteSQL Wierd Error

Feb 13, 2007

hi all!

i have encountered an inconsistent error while creating packages programatically. i am trying to create an ExecuteSQL Task like this:

ExecuteSQLTask sqlTask = (ExecuteSQLTask)sqlTaskHost.InnerObject;

and somtimes it failes on this command with this error:

<Message>Error in generating package C:PROJECTSPOSTALBuildSSIS packagesMappingsMappingsSBSCR_52_OUT.dtsx</Message>

<InnerException>Type 'Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ExecuteSQLTask' in Assembly 'Microsoft.SqlServer.SQLTask, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' is not marked as serializable.</InnerException>

<Data />

<Source>mscorlib</Source>

<HelpLink />

<StackTrace> at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type)

at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)

at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()

at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter)

at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter)

at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)

at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)

at System.Runtime.Remoting.RemotingServices.MarshalToBuffer(Object o)

at Microsoft.SqlServer.Dts.Runtime.ObjectHostImpl.get_InnerObject()

at Microsoft.SqlServer.Dts.Runtime.TaskHost.get_InnerObject()

at InterfaceEngine.OutputInterface.CreateExcel() in C:PROJECTSPOSTALBuildInterfaceInterfaceEngineInterfaceEngineOutputInterface.cs:line 842

at InterfaceEngine.OutputInterface.GenerateOutputPackage() in C:PROJECTSPOSTALBuildInterfaceInterfaceEngineInterfaceEngineOutputInterface.cs:line 322</StackTrace>

<TargetSite />



what is this about? why does it happen , and why not always? the package generation is generated by a web service that is called from an asp.net 2.0 page .



thanks a lot!!!

View 4 Replies View Related

Wierd XML Results From 'Exec SQL Task

Sep 15, 2006

Hi All, we got a problem that I hope you guys can help us with.

We are trying to extract data from a SQL database in XML format to a variable (string) using an 'Execute SQL Task'

In the task we are using an ADO.NET connection to the database which is fine and via direct input we are using this query.

SELECT
title,
initials,
surname,
username,
gender,
emailaddress,
addressline1,
addressline2,
addressline3,
town,
postcode,
country,
emailcontact,
postalcontact,
telephone
FROM
CRMCustRecords
FOR XML path('customer'), root('CRMData'), ELEMENTS XSINIL

In SSMS this is fine and returns an ok (to my eyes anyway!) XML resultset.

<CRMData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<customer>
<title>xxx</title>
<initials>xxxxxxx</initials>
<surname>xxxxxx</surname>
<username>xxxxxx</username>
<gender>x</gender>
<emailaddress>xxxx@xxxxxxx.xx.xx</emailaddress>
<addressline1>xxxxx</addressline1>
<addressline2 xsi:nil="true" />
<addressline3 xsi:nil="true" />
<town>xxxx</town>
<postcode>xxxxxxxxx</postcode>
<country>xx</country>
<emailcontact>x</emailcontact>
<postalcontact>x</postalcontact>
<telephone>99999999999</telephone>
</customer>
<customer>
</CRMData>

However the SSIS task (running exactly the same query) is returning

<ROOT>
<CRMData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<customer>
<title>xxx</title>
<initials>xxxxxxx</initials>
<surname>xxxxx</surname>
<username>xxxxxxxx</username>
<gender>x</gender>
<emailaddress>xxxxx@xxxxxxxxxx.xx.xx</emailaddress>
<addressline1>xxxxxxxxxx</addressline1>
<addressline2 xsi:nil="true" />
<addressline3 xsi:nil="true" />
<town>xxxxx</town>
<postcode>xxxxxxxx</postcode>
<country>xx</country>
<emailcontact>x</emailcontact>
<postalcontact>x</postalcontact>
<telephone>9999999999</telephone>
</customer>
</CRMData>
</ROOT>

I setup the query as a stored procedure and changed the SSIS accordingly. Running the sp from within SSMS was fine but the task still returned the wierd results.

This is completely unexpected and giving us headaches. It doesn't even look like well-formed XML to my eyes and won't display in IE without showing problems! Where are the eroneous /'s and ROOT nodes coming from?

I can't imagine we are the only people to have run into this and I'm sure we aren't doing something quite right - just stuck as to what we're doing wrong.

Hopefully I've provided enough info. If not just ask.

Thanks for any and all input
Pat

View 3 Replies View Related

Wierd: How Much SQL Code Can I Type In A Dataset?!

Oct 3, 2007

Hi
I'm modifying a report from MS CRM. Sales Pipeline. Not the easiest one but still. I just got to the drilldown report and need to change some things in it. I tested the SQL code as I could in SQL Server Management Studio so that I don't have any misspellings (the report I'm modifying is on a remote location). Anyway, now that I copy my code to the SQL Server Business Intelligence Development Studio and to the dataset I'm modyfing I see that a chunk of code from the bottom is missing ... ??? ... is there a limit on how much I can type?!

I counted in Word that I have 33.176 characters and 878 lines of code. Is that to much?!
The original report has a dataset of 27.529 characters and 724 lines of SQL code.

View 27 Replies View Related

Wierd Behavior Of SQL Server While Executing A SP

Dec 2, 2007

Hi Friends,

I am struggling with creating a simple stored procedure, I want to take max(timekey) out in one variable @Val in a dynamic SQL statement as below in SP. When I create this SP, it creates successfully but when I run it I get error

Select @Val=MAX(TimeKey) FROM ABC

Msg 137, Level 15, State 1, Line 1

Must declare the scalar variable "@Val".

Can someone help me in understanding this wierd behavior? And how to get rid of this. Table and SP scripts are as below

CREATE TABLE ABC (TimeKey int, Data_Val int)

CREATE Procedure MAXVal(@Table_Name Varchar(30))

AS

BEGIN

DECLARE @Val INT,

@SQL Varchar(100)

SET @SQL='Select @Val=MAX(TimeKey) FROM '+''+@Table_Name+''



EXECUTE (@SQL)

END


Thanks,
Kul

View 6 Replies View Related

Wierd Font When Exporting PDF File

Jan 7, 2008

Hi,

I used two symbols (”¬€¬ and ”´) in my reporting services page and they appear fine in Internet Explorer. However, when I try to export the page to a PDF file, they appear as question marks.

Can someone tell me why or how to work around this?

Thanks in advance,
Steven

View 5 Replies View Related

Wierd Procedure Performance Behavior

May 15, 2006

I am not sure which of the forums this question should be posted to (Engine or TSQL) so I have posted to both. Please forgive the cross-post.

The problem we are having is with the performance of a stored procedure. Normally, this specific proc will only take seconds to run, but if we at all modify the stored proc in any way, the proc will take at least 20 minutes to run (we don't really know when it will finish because we cut it off at 20 minutes).

When this happens, we can run the profiler and see that a lock and unlock is happening on each record that the query is returning. We are at a loss as to why this is happening.

The only way to fix it (get the proc run time back down to seconds) is to run the engine tuning advisor. We don't even need to apply any of the recommended changes, we just need to run it and the proc performance goes back down to mere seconds.

If we run the profiler again when the proc performs normally, we dont' see any locking going on.

We can consistenly repeat these steps.

Just so we aren't jumping the gun, we have re-written and disected the proc 8 ways to Sunday and it still does the same thing.

Anyone else see this and can offer any suggestions?

View 1 Replies View Related

Wierd Error While Connecting To SQL 2000 In ASP.NET Under VS2005

Nov 8, 2006

Hi,

When I try to run the asp.net application (C#) it is throwing the following exception.

"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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"

The problem is I don't have SQL Server 2005 installed in my system. And I am trying to connect a remote SQL 2000 server.

Adding to my confusion, the same code is working fine in another system.

Help please?

View 9 Replies View Related

MS SQL CREATE TABLE/INSERT INTO Wierd Issue - Going Bald

Sep 11, 2004

Yes, I am pulling my hair out on this one...................

PROBLEM:When importing from my .sql file, I loose many lines of info in my SQL table. I am using the SQL Query Analyzer to execute the file. The file contains 655,000 rows and 20 columns of data on it.

When I run the full file, the system tells me it does not have enough system resources to execute the request. I broke it down just to see if it could handle a smaller file.

When I create a table and have it insert 10,000 rows of info, it drops 88 lines of data.

When I do the same with 120,000 rows I loose 300 rows of data.

When I run it with 56,000 lines of data on the file, I loose 260 rows of data.

When I do just 1,000 rows or below it is perfect.

I have taken the chunks into Excel and verified the number of lines I was trying to put into the table, and everytime, it showed I had the amount of lines I thought I was trying to import.

When I did a query once the table was created to see how many lines it created, I was always short.

This is what my query consisted of (Let me know if this may be my issue)

SELECT COUNT(*) Col_1
FROM nfo_tablename
GO

I even tried zero column names

Any suggestions??? Am I doing something wrong here? Should I be executing the process in a different way?

Here is the basic idea of what the top part of my "CREATE TABLE" file looks like (Color coded as I see it in my Query Analyzer):


Code:


CREATE TABLE nfo_tablename(
Col_1 Numeric,
Col_2 Character(4),
Col_3 Character(11),
Col_4 Character(25),
Col_5 Character(6),
Col_6 Character(5),
Col_7 Character(3),
Col_8 Character(6),
Col_9 Character(22),
Col_10 Character(2),
Col_11 Character(10),
Col_12 Numeric,
Col_13 Character(9),
Col_14 Character(2),
Col_15 Character(2),
Col_16 Character(2),
Col_17 Character(8),
Col_18 Character(1),
Col_19 Character(25),
Col_20 Character(39),
Col_21 varchar);
insert into nfo_tablename values(1,'DSW','UNIT','002-11-K','','57C','840','674209','PCD W/OVRLY DTI/DTM','P','ESPECIAL',674856,'676--9','CO','','1','','1','0201-11','Manufacturer_Name','T');
insert into nfo_tablename values(2,'DSW','SHELF','002-07','','35C','9','09','UNEQUAL','M','',0,'','CO','','','','1','002-07','Manufacturer_Name','T');



Thank you all for your insight. Any ideas, thoughts or suggestions, would be appreciated. I really need to get this table done so I can get a couple web pages created this weekend that are due Monday.

View 1 Replies View Related

Wierd Query Results When Comparing Field Values

May 8, 2008

Hi Guys, I am experiencing weird results

SELECT DSNew, DTTM, RQDT
FROM dbo.Feb
INNER JOIN DMSEFL
ON ACTR = DSNew
where cast(DSNew as varchar(20)) = cast(ACTR As varchar(20))
If I run the above query I get zero recs back.

If I substitute a Value then I get the desired results (ie. where DSNew = '93235500') or if I enter (ACTR = '93235500') or if I put (where DSNew = '93235500' AND ACTR = '93235500')

Can anyone suggest a reason why this is happening. I know the records exist on both tables I ran the query in Acess and got the desired resutls.

Thank you,
Trudye

View 4 Replies View Related

VB (5or6) Does Something Wierd With Image Data While Saving To Sql2000

Apr 27, 2006

Vb stores an image (bitmap/jpg) in a SQL2000 image field. For somereason it doubles the size by adding 00 for each byte. But sometimes itdoesn't add 00 (0000.0000) but 01 or 20 or ?? and also the byte thatshould be transferd is changed...So SQLImageData = Imagebyte + 00and sometimesSQLImageData = CHANGEDImagebyte + xx.Some example data: (hex notation):A1 => A1 0003 => 03 00-----------91 => 18 2083 => 92 018C => 52 01Could anybody give me an explanation, because I need to know what ishappening, so I can remove te extra bytes added......I have already a image when I remove the extra bytes, but with somewrong data (on the place where things like 8C => 52 01 happen)....Thx,Geronimo

View 2 Replies View Related

Wildcard Doesn't Match Using LIKE '%' On A Varchar Field, Wierd!

Jul 20, 2005

Right this has to be a Micro$oft mess-up surely...?I'm running SQL 2k standard with SP3. I have a table which I'm tryingto query using a LIKE operator on a varchar field as follows....WHERE dbo.tbl_pm_projects.SeniorManagerID LIKE '%'....In actual fact the % is passed in by the application when the userselects "All managers" from the drop down list used to select theManager to filter by. If they select a manager's name from the listit becomes LIKE 'ajames' or whatever.BUT - the table currently contains 2972 records. If I take out theWHERE clause the SELECT returns all records - fine - but if I put thewhere clause in it returns only 1682!! I thought the % was meant tomatch, and I quote the SQL server Books Online files here; "Any stringof zero or more characters." Anyone explain to me whats going onhere?TIANiall

View 12 Replies View Related

Wierd, Yet Cool.. Can Login/browse To Server Remotely, But Not Locally.

Jun 11, 2007

I can access the report server remotely. However, when I try to access via browser locally, no luck. I get access denied.

Some kind of browser diff maybe?



I noticed that on the browsers/machines that work, I have the option of putting the domain in seperately. The browser that doesnt work (on the same machine as the db server and web site) puts the domain in front of the username for me.



Any ideas?

View 1 Replies View Related

Update One Colum With Other Column Value In Same Table Using Update Table Statement

Jun 14, 2007

Hi,I have table with three columns as belowtable name:expNo(int) name(char) refno(int)I have data as belowNo name refno1 a2 b3 cI need to update the refno with no values I write a query as belowupdate exp set refno=(select no from exp)when i run the query i got error asSubquery returned more than 1 value. This is not permitted when thesubquery follows =, !=, <, <= , >, >= or when the subquery is used asan expression.I need to update one colum with other column value.What is the correct query for this ?Thanks,Mani

View 3 Replies View Related







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