Click here to Skip to main content
15,949,686 members
Home / Discussions / Database
   

Database

 
GeneralRe: Create an text field in Access from SQL Pin
Jerome Conus23-Oct-03 19:51
Jerome Conus23-Oct-03 19:51 
GeneralRe: Create an text field in Access from SQL Pin
Chris Meech24-Oct-03 2:02
Chris Meech24-Oct-03 2:02 
GeneralRe: Create an text field in Access from SQL Pin
Rob Graham25-Oct-03 5:40
Rob Graham25-Oct-03 5:40 
QuestionSQL 2000: EXECUTE statement context??? Pin
mittalpa21-Oct-03 7:47
mittalpa21-Oct-03 7:47 
AnswerRe: SQL 2000: EXECUTE statement context??? Pin
Rob Graham25-Oct-03 5:43
Rob Graham25-Oct-03 5:43 
GeneralServer Explorer Error Pin
nevhile.net21-Oct-03 6:13
nevhile.net21-Oct-03 6:13 
GeneralRe: Server Explorer Error Pin
Rob Graham25-Oct-03 5:49
Rob Graham25-Oct-03 5:49 
QuestionIf it is a bug? Pin
TPN20-Oct-03 23:17
TPN20-Oct-03 23:17 
I have 4 databases named: db1, db2, db3, db4 on the same SQL Server. All 4 databases have the same table Department(ID, Name) but the data is different. For example:
Table                ID                    Name
db1.Department       1                     Dept1   
db2.Department       1                     Dept2          
db3.Department       1                     Dept3
db4.Department       1                     Dept4


I use SQL Query analyzer to execute the code fragment below:

declare @n int	
declare @Name nvarchar(256)
set @n = 1
while (@n < 5)
begin	
	if (@n = 1) use db1
	else if (@n = 2) use db2
	else if (@n = 3) use db3
	else if (@n = 4) use db4

	select [Name] from Department where [ID] = 1
	set @Name = [Name] from dbo.Department where [ID] = 1
	print @Name

	set @n = @n + 1
end 

The results:
---------------------------------
Dept1
Dept4
---------------------------------
Dept2
Dept4
---------------------------------
Dept3
Dept4
---------------------------------
Dept4
Dept4

But I think the correct result should be

---------------------------------
Dept1
Dept1
---------------------------------
Dept2
Dept2
---------------------------------
Dept3
Dept3
---------------------------------
Dept4
Dept4

The question is: Is there anything wrong from me or from SQL???
AnswerRe: If it is a bug? Pin
Terry O'Nolley25-Oct-03 15:07
Terry O'Nolley25-Oct-03 15:07 
GeneralGroup by Pin
Anonymous20-Oct-03 7:06
Anonymous20-Oct-03 7:06 
GeneralRe: Group by Pin
Chris Meech20-Oct-03 8:00
Chris Meech20-Oct-03 8:00 
GeneralMultiple SOMETHING in DataGrid Pin
Cirrus200019-Oct-03 21:00
Cirrus200019-Oct-03 21:00 
GeneralRe: Multiple SOMETHING in DataGrid Pin
Guillermo Rivero20-Oct-03 3:59
Guillermo Rivero20-Oct-03 3:59 
GeneralRe: Multiple SOMETHING in DataGrid Pin
Cirrus200020-Oct-03 10:19
Cirrus200020-Oct-03 10:19 
GeneralComplex DataBinding, advice required Pin
Anonymous18-Oct-03 7:15
Anonymous18-Oct-03 7:15 
QuestionIDENTITY COLUMN QUESTION??? Pin
mittalpa18-Oct-03 4:45
mittalpa18-Oct-03 4:45 
AnswerRe: IDENTITY COLUMN QUESTION??? Pin
andyharman20-Oct-03 11:53
professionalandyharman20-Oct-03 11:53 
GeneralRe: IDENTITY COLUMN QUESTION??? Pin
mittalpa21-Oct-03 4:42
mittalpa21-Oct-03 4:42 
GeneralEmbedded Query Pin
Chris Meech17-Oct-03 9:04
Chris Meech17-Oct-03 9:04 
GeneralRe: Solution Pin
Chris Meech20-Oct-03 4:59
Chris Meech20-Oct-03 4:59 
GeneralServer link Pin
Anonymous17-Oct-03 4:55
Anonymous17-Oct-03 4:55 
GeneralRe: Server link Pin
Colin Angus Mackay17-Oct-03 6:21
Colin Angus Mackay17-Oct-03 6:21 
GeneralVB.NET datagrid Pin
Anonymous16-Oct-03 12:30
Anonymous16-Oct-03 12:30 
GeneralRe: VB.NET datagrid Pin
Edbert P16-Oct-03 20:15
Edbert P16-Oct-03 20:15 
GeneralADO+&quot;Update&quot;+RecordsAffected+&quot;VC++&quot; Pin
DaviziN16-Oct-03 5:31
DaviziN16-Oct-03 5:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.