Odd Order By Behaviour

Feb 24, 2004

Might be out to lunch, but I can't figure why this is being ordered the way it is:





SELECT '1' as t


UNION ALL


SELECT 'A' as t


union all


SELECT '['as t


ORDER BY t





I'd expect it to be 1, A, [ but instead it's [, 1, A [ is ascii 91 which is greater than both 1 and A, so why does it come first?





Karl

View 2 Replies


ADVERTISEMENT

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

Express Will Not Load. Insurmountable Difficulties With Order Of Uninstalls/order Of Installs/ Suggestions Plz

Jan 7, 2007

Finding the "pieces of information" I need to successfully install the SQL Server Express edition is so complex. Uninstalls do "not" really uninstall completely, leading to failure of SQL install. Can you suggest a thorough, one-stop site for directions for the order of app uninstalls and then the order for app installs for the following...

SQL Server Express edition

Visual Studios 2005

Jet 4.0 newest upgrade

.Net Framework 2.0 (or should I use 3.0)

VS2005 Security upgrade

Anything else I need for just creating a database for my VS2005 Visual Basic project?

I was trying to use MS Access as my backend db but would like to try SQL Express



Thank you, Mark





View 7 Replies View Related

Conditional Order By - Sort Result Set By Employee Number Ascending Order

Sep 24, 2012

In SQL sERVER 2008, I have two fields - Depatment and Employees. I need to sort the result set by employee number ascending order, with following exception

1)when department number = 50 - the preferred order is Employee # - 573 followed by 551-572 (employee # belong to Dept 50 = 551-573)

2)When Department number = 20 – the preferred sort order is Employee # 213-220, followed by Employee # 201-213 (employee # belong to Dept 20 = 201-220)

How shall I achieve this?

View 4 Replies View Related

Analysis :: Order Of Rows In Tabular Table Not In Same Order Data Was Retrieved?

May 19, 2015

I never paid much attention to this before but I noticed this today in a new table I was creating.

For tables defined in the tabular model the table properties have something like SELECT Blah FROM TableName ORDER BY Blah Then in the tabular model the table's data is in the same order it was ordered by in the data source for the table.

I have a date table I setup and I noticed it is NOT respecting the sort order.

I have it sorted by DateID which sorts with the oldest date first and newest date as last row.However, the table that is imported and stored in the data model is not in that order.

I can of course manually sort the rows in BIDS/DataTools, but I find this discrepancy odd.

Would this have negative impacts on the EARLIER function for example if the data rows are not in the order specified?

View 8 Replies View Related

Strange Behaviour

Oct 3, 2006

This is the actual statement displayed from Response.Write in classic ASP. INSERT INTO WOTasks (WoNum,TaskNum,TaskDesc,TaskMemo,Account,ModifyDate,Estimate,TaskHours,Unit,UnitCost,TotalCost) SELECT '06-012497',TaskNum,TaskDesc,TaskMemo,Account,'2006-Oct-3',1,TaskHours,Unit,UnitCost,TotalCost FROM Tasks WHERE procnum = '000002' There are 4 records returned from the SELECT part of the statement. In some situations, 4 records are inserted to WOTasks table, in others, only 1 record is inserted. I can't find out why 1 record, instead of 4, record is inserted. A form page submits the form to the save page using post method. The above statement is contained in the save page. When one of the form textbox is filled, 1 record is inserted. When the textbox is not filled, 4 records are inserted. You may think the textbox has something to do with the behaviour. I also think so but the content of the textbox does not affect the sql statement. In both cases, the insert statement is the same. In the actual codes, only strings in quotes are variables and the rest are hardcoded. When I run the statement in SQL Server, 4 records are affected. No such problem when connected with Access.The actual code belowSub AddTask(ByVal proc, ByVal wonum)   Dim sSQL   sSQL = "INSERT INTO WOTasks (WoNum,TaskNum,TaskDesc,TaskMemo,Account,ModifyDate,Estimate,TaskHours,Unit,UnitCost,TotalCost) SELECT '" & wonum & _          "',TaskNum,TaskDesc,TaskMemo,Account,'" & curDate & "',1,TaskHours,Unit,UnitCost,TotalCost FROM Tasks WHERE procnum='" & proc & "'" 'Response.Write sSQL:Response.End   conn.Execute sSQL, , 128 End Sub

View 2 Replies View Related

Odd (slow Behaviour Of SQL)

Apr 13, 2006

Hi,

I am using MSDE and Analysis Services (lastest packs) and the same installation on the same machine has been working great for the last 18 months or so untill yesterday. Whenever I try to open a DTS (in order to edit it) the machine just goes into a coma.... I have tried to re-start many times but of no use.

Can someone kindly guide me what should I look for in order to solve this.

I will be very grateful for your help.

View 14 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

Query Behaviour

Dec 2, 2005

Hi there,
I wonder if one of you worthy folks can help me out with some strange behaviour exhibited by a piece of SQL. Its my first post here , so please be gentle. :)

Here is my simple example :-

<my test table>

create table test
(ind int,
message varchar(255))

insert into test (ind, message) values
(1,'date=01/06/2006')

insert into test (ind, message) values
(1,'date=20/12/2005')
insert into test (ind, message) values
(2,'test')

The first query is

select * from test t1
where t1.ind in (select max(ind) from test t2
where t2.ind = t1.ind
and t2.message like 'date=%' )

fine.... 2 rows

second query

select * from test t1
where t1.ind =1
and convert(datetime, (SUBSTRING(Message, CHARINDEX('=',Message,0)+1, 10)),103) > getdate()

fine same 2 rows...

but If I try to combine the 2 clauses in


select * from test t1
where t1.ind in (select max(ind) from test t2
where t2.ind = t1.ind
and t2.message like 'date=%' )
and convert(datetime, (SUBSTRING(Message, CHARINDEX('=',Message,0)+1, 10)),103) > getdate()


I get a
Server: Msg 241, Level 16, State 1, Line 1
Syntax error converting datetime from character string.

Please can anyone help me on this?

thanks

Simon

View 9 Replies View Related

Can Someone Explain This Behaviour?

Jul 23, 2005

Hello All,The following script is reproducing the problem assuming you haveNorthwind database on the server.Please note it gives you the error message on line 12.USE tempdbGOsp_addlinkedserver 'Test17'GOsp_setnetname 'Test17', @@SERVERNAMEGOIF EXISTS (SELECT 1 FROM dbo.sysobjects WHERE id =object_id(N'[dbo].[This_works]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)DROP PROCEDURE [dbo].[This_works]GOCREATE PROCEDURE This_works@UseLinkedServer bit = 0-- WITH RECOMPILE -- Does not helpASSET NOCOUNT ONIF @UseLinkedServer = 1 -- Linked ServerBEGINIF EXISTS (SELECT 1 FROM dbo.sysobjects where id =object_id(N'[dbo].[Orders_TMP]') and OBJECTPROPERTY(id, N'IsUserTable')= 1)DROP TABLE dbo.Orders_TMPSELECT * INTO dbo.Orders_TMP FROM Test17.Northwind.dbo.OrdersENDELSE -- LocalBEGINIF EXISTS (SELECT 1 FROM dbo.sysobjects where id =object_id(N'[dbo].[Orders_TMP]') and OBJECTPROPERTY(id, N'IsUserTable')= 1)DROP TABLE dbo.Orders_TMPSELECT * INTO dbo.Orders_TMP FROM Northwind.dbo.OrdersSELECT 1 FROM dbo.Orders_TMP WHERE 1 = 2 -- Why do I need this line?ENDBEGIN TRANSACTIONSelect 'Line 25'SELECT COUNT(*) FROM dbo.Orders_TMPCOMMITgoIF EXISTS (SELECT 1 FROM dbo.sysobjects WHERE id =object_id(N'[dbo].[This_does_not]') and OBJECTPROPERTY(id,N'IsProcedure') = 1)DROP PROCEDURE [dbo].[This_does_not]GOCREATE PROCEDURE This_does_not@UseLinkedServer bit = 0-- WITH RECOMPILE -- Does not helpASSET NOCOUNT ONIF @UseLinkedServer = 1 -- Linked ServerBEGINIF EXISTS (SELECT 1 FROM dbo.sysobjects where id =object_id(N'[dbo].[Orders_TMP]') and OBJECTPROPERTY(id, N'IsUserTable')= 1)DROP TABLE dbo.Orders_TMPSELECT * INTO dbo.Orders_TMP FROM Test17.Northwind.dbo.OrdersENDELSE -- LocalBEGINIF EXISTS (SELECT 1 FROM dbo.sysobjects where id =object_id(N'[dbo].[Orders_TMP]') and OBJECTPROPERTY(id, N'IsUserTable')= 1)DROP TABLE dbo.Orders_TMPSELECT * INTO dbo.Orders_TMP FROM Northwind.dbo.Orders--SELECT 1 FROM dbo.Orders_TMP WHERE 1 = 2 -- Why do I need this line?ENDBEGIN TRANSACTIONSelect 'Line 25'SELECT COUNT(*) FROM dbo.Orders_TMPCOMMITGOPRINT 'This_works'EXECUTE This_works 0PRINT ' 'PRINT 'This_does_not'EXECUTE This_does_not 0Thanks for any help or hint,Igor Raytsin

View 8 Replies View Related

Sp_getapplock Behaviour After SP2

Mar 23, 2007

We have an application that executes a few queries against an SQL Server 2005 (64-bit) database. Since there can be several instances of the application running at any given time, and parts of the logic must be serialized, we've been using sp_getapplock and sp_releaseapplock. This has all been working fine since RC1 on which the system was released. However, after installing SP2 about a week ago, we have been having problems. The serialized portion of the code almost always stall now.

To see what is happening we've been using both Management Studio and Profiler. We have two applications running, let's call them A and B. Both create a prepared statement which begin with a call to sp_getapplock and ends with sp_releaseapplock. In between some tables are queried and inserts may be made in others. The accessed tables are never used anywhere else but in the serialized code. This is what is happening:

Application A: Calls sp_getapplock.
Application A: Queries a table.
Application B: Calls sp_getapplock.
Application A: Inserts a row in a table.
Application A: Calls sp_releaseapplock.
Application B: Waits indefinitely (or at least more than 4 hours, after which we killed the spid).

Profiler cannot detect any deadlocks when this is happening. There are no blocking operations according to Management Studio. I can see the application lock having been set when I look at the spid for Application B in Management Studio.

Since this started to occur frequently after installing SP2 and had not been seen before, we are wondering if any changes has been made that could cause this behaviour? Has anyone else had problems using application locks, where a query would stall indefinitely waiting for the lock to be released? How then did you resolve it?

Any suggestions or ideas are welcome,
Thanks,
Lars

View 9 Replies View Related

CTE Behaviour In SQL 2005

Feb 17, 2006

I were trying to achive paging through using a CTE etc, but ran into the following weither thing happening. The CTE allows me to use avariable as the ORder By field, although the CTE do not care at all what is in there? Have any one seen this or maybe can explain this?











USE AdventureWorks;

GO

DECLARE @SortExpression Varchar(50)

Set @SortExpression = 'SalesPersonID ASC';

WITH Sales_CTE (RowNumber, SalesPersonID, NumberOfOrders, MaxDate)

AS

(

SELECT

ROW_NUMBER() OVER(Order by @SortExpression) RowNumber,

SalesPersonID, COUNT(*), MAX(OrderDate)

FROM Sales.SalesOrderHeader

GROUP BY SalesPersonID

)

Select * From Sales_CTE;





WITH Sales_CTE1 (RowNumber, SalesPersonID, NumberOfOrders, MaxDate)

AS

(

SELECT

ROW_NUMBER() OVER(Order by SalesPersonID ASC) RowNumber,

SalesPersonID, COUNT(*), MAX(OrderDate)

FROM Sales.SalesOrderHeader

GROUP BY SalesPersonID

)

Select * From Sales_CTE1

View 1 Replies View Related

DBDate - Different Behaviour

Nov 20, 2007

When I run the package from business solution environment, DBdate cast converts my date column (correctly) into a European date format dd/mm/yyyy and as such is inserted into sql server table.

When I run a package as a job, the same date in inserted into the database as mm/dd/yyyy.

So, if I have 3rd January 2007 in the source, in the first case i'll find 03/01/2007 in the database.
When I run the package as a job, I find 01/03/2007 in the db.

The problem comes when I run different select statements - the 01/03/2007 behaves as if 1st March 2007

How can I avoid inserting of American data format into the db?

View 23 Replies View Related

Strange Behaviour

Aug 8, 2007



Hi,

In My report I have 2 drop down list called Cusip and Period as parameters and they are populated using a sproc

I have a list and in my list i have 2 textboxes which have the value First(Fields!FundNameNoFee.Value) and First(Fields!FundDescription.Value)


The Cusip drop list has the following values <All Cusips> whchi takes the Value Null, 33335454, 115544454.

If i give all cusips in preview mode Nothing populates in the report, but i just run the dataset i get 2 records with 33335454,1155445454.

and if i give individual cusip, the data shows up in the report...

So can some one tell me how can i show the values on the reports when All Cusips are selected....
Regards
Karen

View 3 Replies View Related

ADS - A Strange Behaviour

Oct 11, 2007



Hi to all!
i had tried to install ads on a windows 5. i am able to connect to the pocket database. however when i trie to connect to the database that's on desktop i see a little window (probably a message) without anything and when i tap ok i see a message telling that the connection to the desktop database was not done! i had made the configuration before.
can you tell me what is going wrong?

View 1 Replies View Related

SetRange Behaviour

Jan 22, 2008

I'm trying to use SetRange method on a table with multi-columns index, but I didn't get the result I was hoping for from the query.

Here is the DDL for the table






Code Block

CREATE TABLE [Products] (
[ProductId] INT IDENTITY(1,1) NOT NULL ,
[ArrivalDate] DATETIME ,
[Name] NVARCHAR(100) ,
[CategoryId] INT,
CONSTRAINT [PK_Products] PRIMARY KEY
(
[ProductId]
)
)
;
CREATE INDEX IDX_ProductArrival
ON [Products]
([ArrivalDate], [Name], [CategoryId])
;


--insert some sample data


Insert into [Products] ([ArrivalDate], name, categoryid) values ('2008-1-22 13:00:00', 'PC 1', 1);
Insert into [Products] ([ArrivalDate], name, categoryid) values ('2008-1-22 13:00:00', 'PC 2', 2);
Insert into [Products] ([ArrivalDate], name, categoryid) values ('2008-1-22 13:00:00', 'PC 3', 3);


And here is the code I'm using




Code Block

using System;
using System.Data.SqlServerCe;
using System.Data;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
using (SqlCeConnection conn = new SqlCeConnection(@"data source=d:mydb.sdf"))
{
conn.Open();

int counter = 0;
using (SqlCeCommand cmd = new SqlCeCommand("products", conn))
{

cmd.CommandType = CommandType.TableDirect;
cmd.IndexName = "IDX_ProductArrival";

object[] start = new object[3];
object[] end = new object[3];

start[0] = new DateTime(2008, 1, 22, 0, 0, 0);
start[1] = "PC 2";
start[2] = 2;

end[0] = new DateTime(2008, 1, 22, 23, 59, 59);
end[1] = "zzzzzzzzzzzzzzz";
end[2] = 3;

cmd.SetRange(
DbRangeOptions.InclusiveStart | DbRangeOptions.InclusiveEnd,
start, end);

using (SqlCeDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
counter++;
}
}
}

conn.Close();
Console.WriteLine("Row count {0}", counter); //should show row count 2 but shows row count 3 instead
}

Console.ReadKey();
}
}
}
I'm setting the starting range to a date and a product name (PC 2) but it seems that the datareader only see the first array member and completely ignore the product name and show all 3 data instead of 2.

Am I missing something here?

Thanks

View 2 Replies View Related

Calculate Total Amount Of Order Details Based On Particular Order

Apr 10, 2014

I have a query that calculate the total amount of order details based on a particular order:

Select a.OrderID,SUM(UnitPrice*Quantity-Discount)
From [Order Details]
Inner Join Orders a
On a.OrderID=[Order Details].OrderID
Group by a.OrderID

My question is what if I wanted to create a formula to something like:

UnitPrice * Quantity - DiscountAmount Where DiscountAmount = UnitPrice Quantity * Discount

Do I need to create a function for that? Also is it possible to have m y query as a table variable?

View 7 Replies View Related

Default Sort Order - Open Table - Select Without Order By

Mar 27, 2008

Hi!

I recently run into a senario when a procedure quiered a table without a order by clause. Luckily it retrived data in the prefered order.

The table returns the data in the same order in SQL Manager "Open Table"

So I started to wonder what deterimins the sort order when there is no order by clause ?

I researched this for a bit but found no straight answers. My table has no PK, but an identiy column.

Peace.

/P

View 5 Replies View Related

How To Add Order Item Into A Purchase Order Using A Stored Procedure/Trigger?

Jan 4, 2008

Hey guys, i need to find out how can i add order items under a Purchase Order number.
My table relationship is PurchaseOrder ->PurchaseOrderItem.

below is a Stored Procedure that i have wrote in creating a PO:



CREATE PROC spCreatePO (@SupplierID SmallInt, @date datetime, @POno SmallInt OUTPUT)

AS

BEGIN

INSERT INTO PurchaseOrder (PurchaseOrderDate, SupplierID) VALUES(@date, @SupplierID)

END



SET @POno = @@IDENTITY

RETURN


However, how do i make it that it will automatically adds item under the POno being gernerated? can i use a trigger so that whenever a Insert for PO is success, it automaticallys proceed to adding the items into the table PurcahseOrderItem?


CREATE TRIGGER trgInsertPOItem

ON PurchaseOrderItem

FOR INSERT

AS

BEGIN


'What do i entered???'
END

RETURN


help is needed asap! thanks!

View 14 Replies View Related

SQL Express' Strange Behaviour

Oct 25, 2007

We have this webiste which uses SQL express as database engine. Sometimes certain features of the website stop working. Like membership provider and other database related things. I have described the problem in more details here: http://forums.asp.net/t/1172253.aspx
In consice the problem is: One query with fixed inputs does not always return the same results, though the data has not changed, you restart the SQL express and the problem resolives!
I think thats a problem with SQL express, because when you restart SQL express everything starts working. Our database is kinda big. Like above 500 MB with up to 50 concurrent users. And our machine got a 3.2 CPU with 512 MB of ram. And our application is the only application runing there.
What do you think please?

View 5 Replies View Related

Strange Query Behaviour

Aug 12, 2000

Hi...

Not sure what's wrong with the query or table, but I just can't get the result I want.

The column is varchar(35) and contains toll free no, like 18001234567...

But when I queried using the query below, I can't get any results. Same if I use 1*, 18*, 180*...

SELECT ... FROM ...
WHERE CONTAINS(toll_no, '"1800*"')

However, if I used 18001* I do get results.
Can anybody show me how to get result for these cases?

Thanks.

View 2 Replies View Related

Strange Shceduled Job Behaviour

Oct 12, 2000

I have a scheduled job that inserts some records into a table. It fails with the following message,
Violation of PRIMARY KEY constraint 'PK_FuturesOut'. Cannot insert duplicate key in object 'FuturesOut'. [SQLSTATE 23000] (Error 2627) The statement has been terminated. [SQLSTATE 01000] (Error 3621). The step failed.

The strange thing about this is, if I copy the SQL statement from the job and paste it into Query Analyzer, it works without any modifications.

If anyone can explain this I would be most grateful.

View 2 Replies View Related

View Behaviour With Index.

May 12, 2006

Hi

If I have a view:

SELECT A,B
FROM tblTable
WHERE A = 1

And then I have a s-proc using that view:

SELECT *
FROM MyView
WHERE B > 6

My question: If I add an index to tblTable for the column B (not used in the view's WHERE clause, but used in the s-proc), will it have a performance improvement, because of the WHERE B > 6 on the view, assuming that this condition would benefit from the index if it were in the view itself.

I guess I could also put it this way: can an index on a column in a table improve the performance of a condition on a view using that table.

Thanks

Peter

View 2 Replies View Related

Bcp Queryout Strange Behaviour

Aug 3, 2007

I use bcp fairly often in SQLServer2000 but have never run across this before. In a 512 SQLCHAR column containing notes, when two spaces are encountered (i.e. ' '), bcp is replacing ' ' with '
'.

I figured it was a problem with my format file, but I have not found enough specific info on the MSDN site to resolve this.

This is my bcp command:

bcp "SELECT DivCode,CommCode,ContactID,substring(Notes, 0, 512) from frep.dbo.BeBackExtract" queryout "D:BeBackDetail.dat" -f "D:BeBackDetail.fmt" -e "D:BeBackDetailErrors.dat" -U user -P pass -S server

And format file:

8.0
4
1 SQLCHAR 0 2 "" 1 DIVCODE ""
2 SQLCHAR 0 3 "" 2 COMMCODE ""
3 SQLCHAR 0 10 "" 3 CONTACTID ""
4 SQLCHAR 0 512 "
" 4 NOTES ""

Has anyone seen this?

Incidentally I also tried using the REPLACE function which seems to work great until trying to replace 2 spaces with 1 space, in which case it doesn't do anything.

Thanks for any ideas -

View 1 Replies View Related

DTS Package Behaviour When Used By &> 1 User?

Apr 20, 2004

Hi all

I have a DTS package that users of the database can run which basically acts like a 'live update' (as the database is based on a values produced from another system) and it takes roughly 30 or so seconds to run...

The dts package is not going to have a particularly large hit rate but i am interested in knowing what will happen if a user (user 1) attempts to run the package when it is in already in use by another user (user 2) ?

Will User 1 simply have to wait untill the package completes for User 1?

OR

Will a new seperate 'instance' of the package be used by User 1?

Any info would be very helpful

Cheers

View 2 Replies View Related

Inexplicable Behaviour Of Select

Apr 13, 2007

Hi

Just tried to Run the Following statement in Query Analyzer
Select convert(varchar(9),convert(integer,1234567890))

The Output was an * (asterisk)
Can Some one Explain Y??

Thanks in advance

View 7 Replies View Related

Locking Behaviour On JOIN

Jul 23, 2005

Hello all,I have what I hope is a simple question:Does SQL Server have an 'all-or-nothing' locking policy? Or does itacquire as many locks as it can and then sit and wait for the rest?Example:SELECT * FROM TABLE_A INNER JOIN TABLE_BON TABLE_A.dbid = TABLE_B.dbidNormally a SHARED lock would be acquired on both objects (pleasecorrect me if I'm wrong). But let's say TABLE_B was being updated byanother process at the same time, and so we couldn't get the sharedlock. Would the dbms go ahead and acquire the shared lock on TABLE_Aand then wait for the other lock, or would it not acquire any lock atall until locks on both TABLE_A and TABLE_B were available?I ask because I'm investigating a deadlocking problem that's drivingme mad :)Thanks,Tommy.

View 3 Replies View Related

Funny Network Behaviour

Jul 20, 2005

Hi,In order to establish a security enhanced SQL server setup, I triedto switch off network access by disabling all networking protocols,so that the server can only be reached through a pipe. Neverthelessthe server was visible in the network and could be accessed fromall clients. Does anybody know what is going on here?Georg

View 1 Replies View Related

View Behaviour In Join

Jul 20, 2005

Hi Everybody,I have a complex view, that includes a "group by" clause. I'm tryingto join this view with a table, in a very simple query.The problem is that the optimizer is not using the table data as inputfor the view (I expect this because I have arguments for the table,but not for the view), but executing the view in a different step andthen joining to the table by a merge/hash join. This is obviously veryslow.I tried to force nested loops by using hints but it still doesn't usethe table data as input.Has anybody ever seen this?Thanks in advance...

View 3 Replies View Related

Sql Management Studio Behaviour

Nov 14, 2006

Hi everyone,

I wonder if it's possible keep the connections previously opened in your Sql Management Studio.

I mean, I open it and connecting to sql1,sql2,sql3,etc.. without using queries or something like that and then, close and re-open again. What happens? Neither of them appearing again. If you create a project, of couse...but it's not the same, because when you create a .ssmssln project file is inteded for keep .Sql.

I'm talking about the same behaviour when you ran the old Enterprise Manager inside the Microsoft Management Console and you had the possibility of make groups and whatever.

View 1 Replies View Related

Weird SSIS Behaviour

Sep 20, 2007



I have 2 exact same sql tasks in different packages. Connection manager is defined for the same database for both. one of the sql task works, and other one throws out this error:
[Execute SQL Task] Error: Failed to acquire connection "pdsprod.pdsdataread". Connection may not be configured correctly or you may not have the right permissions on this connection.

this is completely mind boggling. I have compared both sql tasks for each and every property and they are exactly the same. what is going on?

by the way I am on 64 bit box with Run64bitruntime= false.

View 5 Replies View Related

Strange Query Behaviour

Nov 15, 2006

Hi,

I am seeming strange results with a query. I have two tables, lets call them Table1 and Table2. Table1 has an ID field, Table2 does not have an ID field. To be sure I wasn't blind, the query

'SELECT ID FROM Table2'

returns: Invalid column name 'ID'. OK. Now when I run the query

'SELECT * FROM Table1 WHERE ID IN (SELECT ID FROM Table2)'

it returns all the records from Table1.

What gives? Is this a bug, or am I missing something?

View 8 Replies View Related

Outer Join Behaviour

Nov 25, 2007

Hi

It may be the stupid mos question but i am stucked badly.

I am having data like this.








Table 1

Table 2

data

data



data



data
Now i am performing a outer join like

select * from table 1
full outer join table2
on table1.data=table2.data.

What output i am expecting is







Table 1

Table 2

data

data

NULL

data

NULL

data
But output i am getting is







Table 1

Table 2

data

data

data

data

data

data
Could you guys please help me in getting desired result in optimum way?

Thanks a lot in advance.

View 9 Replies View Related







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