|
|
|
hi
i wanna update some rows in files table but i face with error.
can every one help me?
my code is :
UPDATE [Common]..[com_Files] SET
[ReferenceGuid] = (SELECT [Guid] FROM [Personnel]..Missions
WHERE [PersonnelSystem]..Missions.ID= [Common]..[com_Files].ReferenceID)
WHERE
[ReferenceFlag] = 72 AND
[ReferenceGuid] IS NULL AND
[ReferenceSoftwareGuid] = '66944D9C-31F4-4594-9407-4E1F64C079D9' and
[ReferenceID]= [PersonnelSystem]..Missions.ID
GO
thanks for any help
|
|
|
|
|
mehdi.sabet wrote: [Common]..[com_Files]
mehdi.sabet wrote: [PersonnelSystem]..Missions.ID
mehdi.sabet wrote: [Common]..[com_Files].ReferenceID
Why two dots? Does not look correct.
|
|
|
|
|
this is ok in my frame work
and you use this query with one dot
my problem is in join but not in dots
thank you for reply
|
|
|
|
|
You forget to include the error, and a hint as to which DBMS you're using.
Assuming MS SQL, try:
UPDATE
F
SET
[ReferenceGuid] = M.[Guid]
FROM
[Common]..[com_Files] As F
INNER JOIN [PersonnelSystem]..Missions As M
ON F.ReferenceID = M.ID
WHERE
F.[ReferenceFlag] = 72
AND
F.[ReferenceGuid] Is Null
AND
F.[ReferenceSoftwareGuid] = '66944D9C-31F4-4594-9407-4E1F64C079D9'
;
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
ok thanks for reply
i solved this problem with this code:
UPDATE mycompany.dbo.Files
SET [ReferenceGuid] = ( SELECT mission.[GUID]
FROM dbo.Mission mission
WHERE mission.ID = [ReferenceID]
)
WHERE [ReferenceSoftwareGuid] = '66944D9C-31F4-4594-9407-4E1F64C079D9'
thanks anyway
|
|
|
|
|
in my database Table i have a column name BookDate(nvarchar) 22/03/2013 01:25 PM stored data in this format
now i need to match only with date out of date time it should be matched with current date please help with a query
Thanking you
|
|
|
|
|
nukalarajesh wrote: BookDate(nvarchar)
Don't store dates as strings. Change the column to datetime (or datetime2(0) if you're using SQL 2008 or higher), and then query for BookDate >= @Today And BookDate < @Tomorrow .
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
If you are wondering why your other post was removed (in less than 10 minutes!), it was because of the "urgency". We're volunteers, answering questions in our spare time. Had you included it with your question, then the question would have been gone too.
If you want an answer "fast", then you better make sure that there's a clear problem description, and some example-code showing what you tried to achieve. You might also want to include a subject-line that's a bit more descriptive; posts in the database-forum usually have some SQL, and it doesn't give a clue of what you're doing.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Just in case you did not take Richard seriously - DO NOT STORE DATES AS TEXT, USE THE DATETIME DATATYPE. This is the basis of your problem.
How do I make that red, can I make it flash, can I make it jump through the monitor and thump it into the desk?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
use trunc(your_field name)= trunc(sysdate) or sysdate-1 for yesterday.
or trunc(field_name)='12-apr-2012'
|
|
|
|
|
i'm accessing this .sql file from a .ksh(script) file.
error-subprogram or cursor reference out of scope
{code}
declare
CURSOR cur AS select a from abc;
begin
for i in cur loop
dbms.putline('recored is' rec.recor_num);
end loop
|
|
|
|
|
What database is this for as it doesn't look like a SQL Server cursor
TSQL Cursor[^]
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
It looks like Oracle PL/SQL to me(I used this 7+ months ago so I could be wrong...)
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
Not used Oracle for a while but I would have a read of this Stackoverflow: pl-sql cursor[^]
it shows how you would construct your cursor. I think your problem is here
GugliMugli wrote: CURSOR cur AS select a from abc;
it should be
declare cursor cur is
select a from abc
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
sorry..
i mentioned 'AS' instead of 'IS'..
the complete cursor is
CURSOR cur IS select a from abc.
this is oracle pl/sql..
|
|
|
|
|
|
hello my Friends
I do not convert sql server 2008 r2 database to sql server 2005
Please help me 
|
|
|
|
|
You can't simply back up and restore as you would going the other way, so you are going to have to script the schema across and then write a script to transfer the data.
Red-Gate have tool that we use to do this job (usually between UAT and production, never 2008 => 2005)
[edit] Red-Gate are not free or cheap and it may not be worth it for a one off job [/edit]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
I think you posted this reply to the wrong person, although from the titles I did not know you could use backup/restore, interesting.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
OK, thank you very much for your reply.
I moved my answer...
|
|
|
|
|
|
hi to all
i want to know that whats difference between below two query?
and which of those is better of another in performance respective?
SELECT ID INTO #TempLoan FROM bml.Loan WHERE id IN(1,2,100,700)
SELECT * FROM #TempLoan
and this query:
WITH TempLoan(id)
AS
(SELECT ID FROM BML.Loan WHERE id IN(1,2,100,700))
SELECT * FROM TempLoan
thank you for any idea
|
|
|
|