I was not expecting the ContactGUID to be set with zeros but the default NEWID() to be returned to the client.
This is not happening.
I have tried to change about every property of the contactguid field (particularly StoreGeneratedPattern) but nothing seems to have any action.
Did someone hit this problem?
The generated SQL then seems very good, as not only the default value are not overwritten but they are returned to the client in a single query.
declare @generated_keys table(ContactGUID uniqueidentifier)
insert [dbo].[dtblContact](surname, forname)
output inserted.ContactGUID into @generated_keys
values ('Blog', 'Joe')
from @generated_keys as g
join [dbo].dtblContact as t on g.ContactGUID = t.ContactGUID
where @@ROWCOUNT > 0
With simple inner join here is query which you need:
select p.poke_id, s.[Name] as Poke_Giver_Name,s2.[Name] as Poke_Receiver_Name
from students s
inner join Poke p on p.Poke_Giver_Id = s.Student_Id
inner join students s2 on s2.Student_Id = p.Poke_Receiver_Id
I Love T-SQL
"VB.NET is developed with C#.NET"
If my post helps you kindly save my time by voting my post.
Declare @Student table(StudentID int identity,Name varchar(20))
Declare @Poke table(Poke_Id int identity,Poke_Giver_Id int,Poke_Receiver_Id int)
insert into @Student values('Alex'),('Bob'),('Caveman')
insert into @Poke values(1,2),(1,2),(2,1)
Select x.Poke_Id,x.Poke_Giver_Name,Poke_Receiver_Name = s.Name
Select p.Poke_Id,s.Name Poke_Giver_Name ,p.Poke_Receiver_Id
from @Poke p
join @Student s
on p.Poke_Giver_Id = s.StudentID
join @Student s on s.StudentID =x.Poke_Receiver_Id
Poke_Id Poke_Giver_Name Poke_Receiver_Name
1 Alex Bob
2 Alex Bob
3 Bob Alex
I have 3 reports that run fine individually showing headers and data. The queries use no parameters just a calculated date within the query.
I'm trying to place all 3 reports (They are related but do not require each other)into one document as this is the user requirement and thought that this would be easy using the sub-report feature.
I've taken 1 report and tried dragging and dropping one of the other reports onto the report layout designer where it appears as a grey box with the name of the report in the centre. I've checked the visibility is set to visible and data output is set to Yes (I'm guessing here).
When I preview the report the first report shows fine, i.e. the one I started with, but subsequent reports do not show at all - header or data.
Googling the issue makes me think I'm doing something fundamentally wrong as I can't find a post that outlines the same issue.
I have the following SQL query and it gives me back some syntactical errors and I am not familiar enough with Sql Server to understand exactly what it is I am doing wrong. Thanks in advance for an information!
ALTER TABLE BatchData
DROP CONSTRAINT PK_BatchData
ALTER COLUMN StartTime VARCHAR(50) NOT NULL
ADD PRIMARY KEY (BatchID,StartTime)
Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'COLUMN'.