|
nr1b wrote: how to trigger a new trigger inside a trigger
I think you won't be able to do this. As you know triggers will be fired for insert,update and delete operations. Then how a trigger can trigger another one ?
Inside your trigger, if you update another table which has an update trigger defined, will it be considered as nesting of triggers ? I am confused
|
|
|
|
|
Hi i have some records in my table with date..,
Now my question i will explain with example:
june month have 30 days...,
But in my table,i have 1 to 22 date and 25 to 30 date records...,
Those days using query, i can get from my table...,
Remaining 23 to 24 dates also want to show...,
How to do that...,
Example:(my table look like this.........)
Date m1 m2 m3
06/01/2007 78 67 56
06/02/2007 45 89 76
.
..
06/22/2007 45 23 87
06/25/2007 77 89 45
.
..
06/30/2007 78 56 89
Now it want to show...,
Date m1 m2 m3
06/01/2007 78 67 56
06/02/2007 45 89 76
.
..
06/22/2007 45 23 87
06/23/2007
06/24/2007
06/25/2007 77 89 45
.
..
06/30/2007 78 56 89
How to do taht plz tell me......,
Magesh
|
|
|
|
|
Well, one way to do this is
declare @tempdate table(myDate datetime)
declare @date datetime
declare @enddate datetime
set nocount on
set @date = '01-Jun-2007'
set @enddate = dateadd(mm, 1, @date)
while (@date < @enddate)
begin
insert into @tempdate values (@date)
set @date = dateadd(d, 1, @date)
end
select myDate, m1, m2, m3
from test
right join @tempdate
on myDate = [date]
|
|
|
|
|
ya if i use ur query i am getting all dates...,
But dates are repeating...,
so i am getting totally more than 600 records...,
See i like to pass my month value and year value only...,
for the june month value=6 and year value=2007...,
With that i want to show my table dates and missing dates...,
Like that i need a query...,
Regards,
Magi
|
|
|
|
|
plz said me that what it statement means or what is output
SELECT Max(dispcode) AS Expr1 FROM EsiDisp;
|
|
|
|
|
it selects maximum value from column dispcode of table EsiDisp.
rahul
|
|
|
|
|
thanx for your reply but plz differetiate
SELECT Max(dispcode) AS Expr1 FROM EsiDisp
SELECT Max(dispcode) FROM EsiDisp
|
|
|
|
|
SELECT Max(dispcode) AS Expr1 FROM EsiDisp
will display selected maximum value with column name Expr1
it is nothing just giving alias name to original column name
SELECT Max(dispcode) FROM EsiDisp
will display selected maximum value with column name dispcode
rahul
|
|
|
|
|
Please read the forumn guidelines. Highlights include:
1. Make your message titles meaningful.
2. Don't use words like 'urgent' or 'help' in the message title.
3. Do not use text speak.
______________________
stuff + cats = awesome
|
|
|
|
|
hello frnd,
can any one tell me how can i recover my database using LDF file
what are steps to recover my database ????
Suppose my database is crashed and if i have a backup of database 3 days before can i restore the database using LDF....
please help .....
Thankx in Advance
regards,
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
So, the .MDF file is damaged or missing, but you still have the .LDF? As long as your database was using the Full recovery model, and you have any log backups you've made since the full backup, you can get it back.
Step one - back up the transaction log in SQL Server. Be sure to set the NOTRUNCATE option so that the committed transactions are not removed. Then restore the full backup with the NORECOVERY option. Now restore each previous log backup again with the NORECOVERY option. Finally restore the log backup you just made, this time allowing SQL Server to perform recovery.
The database should now be in a consistent state, and should contain the result of all transactions that had been committed up to the point of failure.
It's worth testing this out on another database, on another server, before you start trying to recover the one you're having a problem with, to ensure you don't make any mistakes. Also consider stopping SQL Server and making a file-level backup of the affected files.
If you're using the bulk-logged recovery model, the log backup operation will need access to any pages in the data file that were changed by any bulk operation. If these pages are unreadable or damaged, the log backup will fail and you won't be able to recover the database to the point of failure. If you're using the Simple recovery model, the transaction log only contains the most recent transactions, it does not represent a complete history. Therefore it cannot be used to recover to point of failure.
|
|
|
|
|
Thankx for your valuable reply...
i want to know answer..
1. can i read the LDF file content ??? how ???
please help...
regards,
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
There is a tool called Log Explorer[^] you can obtain - there is a trial version available from the Downloads section if you register.
|
|
|
|
|
Hi All,
I have created of freetextsearch catalogue based on three columns of datatype nvarchar, col1,col2,col3 now i want to implement this type of logic in freetext search.
If there there is a entery like , "visual C","some value",""
Now if provide this type of syntaxe in query like Contains((col1,col2,col3),@Keyword) and parameter have visual it will return me this row, but if i provide like this "ual C" it will return no row. i want to implement this type of search
"Logic should be so that if the typed in characters is contained anywhere in the course col1/col2/col3 it should be found.
"
Thanks if advance for help.
Many Thanks & Best Regards,
adnan
Many Thanks,
Adnan Rafiq
muhammadadnanrafiq@gmail.com
|
|
|
|
|
adnanrafiq wrote: Contains((col1,col2,col3),@Keyword)
Contains(col1,@Keyword) OR Contains(col2,@Keyword) OR Contains(col3,@Keyword)
|
|
|
|
|
Thanks for Reply, but it will not work for me.
I want same behaviour from freetext serach using freetext or contains predicate, just like '%isual%', the syntaxt you provided will failed for me,
For Example:
let say have table name "table1" having one column "Col1" and table has these values
visual C#
C++
Adobe Photshop
SQL Server
Basic Language
MY SQL
HR Questions
MBA (Marketing)
Here is variable in Store Procedure:
-------------------
DECLARE @KEYWORD NVARCHAR(MAX)
SET @KEYWORD ='Visual';
SELECT * FROM TBALE 1 WHERE Contains(Col1,@KEYWORD)
IT WILL RETURN ME Only one Row Visual
--------------------
SET @KEYWORD ="visu";
SELECT * FROM TBALE 1 WHERE Contains(Col1,@KEYWORD)
if i use this change the variale value to "visu" it wil return me no row
---------------------------
SET @KEYWORD ="sual C#" ;
SELECT * FROM TBALE 1 WHERE Contains(Col1,@KEYWORD)
and if i again change value of vairable to "sual C#" then again no result.
-----------------------------
I want result in these two cases,is the possible.
Again THANKS IN ADVANCE
Many Thanks,
adnan
Many Thanks,
Adnan Rafiq
muhammadadnanrafiq@gmail.com
|
|
|
|
|
Dear All,
I am using Sql server 2005
I would like to know Is it possible to use switch case(like we do in C#) in stored procedure.if not what if alternative of that. Because based on input parameter I would like to perform different action
Please guide me or give me some useful link.
Thanks
regards
imran khan
|
|
|
|
|
|
sql actually has a very poor switch statement. It can only be used in select statements. It looks like this:
Select case
when col1 = 1 then 'true'
when col1 = 0 then 'false'
else 'false'
end -- case
from table1
You can also do:
Select case col1
when 1 then 'true'
when 2 then 'false'
else 'false'
end -- case
from table1
If you are just taking about program flow without select statements all you can use is if and else if statements.
Hope that helps.
Ben
|
|
|
|
|
Hi
I want to calculate the space occupied by an individual row in a table.
Thanks
|
|
|
|
|
Space means bytes or number of tuples which exists?
|
|
|
|
|
Hi
Thanks for reply . I want to calculate space in bytes.
Thanks
Bhaskar
|
|
|
|
|
Hai Buddy,
Cool u can do it as following;)
Find length of data stored in row of SQL Table
select datalength(sizeofrow) from tablename where i = 1
i=1 is kinda condition for fetching row...which u want....
best luk
vishu
Vishu Gurav
University of Nebraska-Lincoln
|
|
|
|
|
Hi,
Thanks for reply, But the query you have given is not working. It is giving Invalid column name 'sizeofrow'. Error
Thanks
vijay
|
|
|
|
|
Oh my apologies you need to have coulumn of that name I think.
Why dont you add one more coulmn name as sizeofrow with varchar(20) datatype.
this will work i believe if not please refer here:
http://blogs.msdn.com/sqltips/archive/2006/07/14/666188.aspx
Thanks,
Vishu
Vishu Gurav
University of Nebraska-Lincoln
|
|
|
|