Thank god
"Izzat" is gift of god. Almighty has been always merciful to me. Thank god!
MySql stored Procedures with multiple statements
Setting password in mysql account
update user set password=null where User='root';
flush privileges;
quit;
Alternative coloring and Image background color
I wanted to simple create a report with alternative background colors. Which I could achieve easily. Now I have a column in this report which is supposed to display image. Based on value from the data field a red or green or blue icon is displayed in this column based on expression. Which is also working fine. Now the problem is after I place an image in this details column (with or without expression). the alternative row coloring stopped working. its always white. I even tried creating a colored background image and still its not helping. Can some one help me out please?
This is expression I have used
=iif(RowNumber(Nothing) mod 2 = 0,Switch(Fields!StatusFlag.Value=10,"red_bg",Fields!StatusFlag.Value=20,"yellow_bg",Fields!StatusFlag.Value=30,"green_bg",True,"Blank")
,Switch(Fields!StatusFlag.Value=10,"red20x20",Fields!StatusFlag.Value=20,"yellow20x20",Fields!StatusFlag.Value=30,"green20x20",True,"Blank"))
red_bg is image is background color while red20x20 is with transparent background. but its not helping...l
If the question is still not clear, please let me know....

Thanks a lot.
Fayaz
Beloved prophet Mohammed's (SAW) last sermon
Lend me an attentive ear, for I know not whether after this year, I shall ever be
amongst you again. Therefore listen to what I am saying to you very carefully
and take these words to those who could not be present here today.
O People
Just as you regard this month, this day, this city as sacred, so regard the life
and property of every Muslim as a sacred trust. Return the goods entrusted to
Ya Allah
Ya Allah, please make us stay happy and satisfied with what you provided us mercifully
Ya Allah, please make us fearless
Ya Allah, please help us get away from poverty
Ya Allah, please help us from being getting humiliated
Ya Allah, please forgive our parents and us as well
Ya Allah, please help us lead a healthier and longer life
Ya Allah, please help us get back beloved masjidul Aqsa
Ya Allah, please help the natives of Gaza to win
Ya Allah, please help them stay patient
Some T SQL Interview questions and Answers
1. How to use sql query to copy only structure?
Ans: select * into table2 from table1 where 1 = 2
2. How do we handle Error?
Ans: I think we can use @@Error. Right after the query condition is executed we can check for @@Error <> 0, if it is not returning zero mean some error occured. Raiserror is another command for raising error We can also use Try catch block
3. What is PatIndex?
Ans: Returns the starting position of the first occurrence of a pattern in a specified expression, or zeros if the pattern is not found
Syntax - PATINDEX ( '%pattern%' , expression )
Eg: USE AdventureWorks;
USE AdventureWorks;
GO
SELECT PATINDEX('%ensure%',DocumentSummary)
FROM Production.Document
WHERE DocumentID = 3;
GO
4. How to query a string contains %?
Ans: SELECT Name FROM tblPlayer WHERE Name Like '%[''%'']'
5. How to get values from a table with comma seperated?
Ans: declare @vName nvarchar(100)
set @vName = ''
select @vName = @vName + ','+ [Name] from HumanResources.Shift
select @vName
6. How to update 'Yes' to 'No' and viceversa in a query?
Ans: Update tablename set ColumnName1 = (case ColumnName1 when 'Yes'
then 'No'else 'Yes' end)
7. Consider you have a table with columns ID(primary key), Country and State.
Now if you have some rows with combination of country and state repeating,
ie, two rows with combination India, Kerala. Write a query for deleting
duplicate records?
Ans: With T1 as
(Select *,Row_Number() over (partition by Country, State order by ID)
as 'RowNo' From TableName)
Delete from T1 where RowNo > 1;
8. How to create temporary table? How do we apply noncluster index? What is nolock? When and where is nolock applied normally?
Ans. Two ways of creating temporary table with non clusterindex applied on it. Also example shows how to apply "nolock". nolock is normally applied while querying on production servers. This would make the records being queried sharable on the table. ie, will not prevent other queries from querying the same record parallely on same table. The risk will be nolock might return junk data some times because the select query might be querying the table while some other insertion or updation commands are performed on the table.
1.
CREATE TABLE #tmpTable
(
OfficeName varchar(50)
, officeid int
, CustID int
, AgentID int
, mlsid varchar(4)
, RequestMoreDetails int null
, Emails int null
)
CREATE NONCLUSTERED INDEX #IX_DW_Listings ON #DW_AllListings(AgentID)
2.
select
OfficeName
, officeid
, o.CustID
, AgentID -
, o.mlsid
, PrintBrochure_Views = null
, RequestMoreDetails = null
, Emails = null
into #ForOffices from #Offices o
LEFT JOIN dbo.planparts WITH (NOLOCK)
ON bppa.officeid = o.RID
CREATE NONCLUSTERED INDEX #IX_DW_Listings ON #ForOffices(AgentID)
9. Another simple example for using temporary table.
Also how to split a single column in to multiple columns based on column value.
Here date_format function format date to yyyymm format.
period_diff function returns number of months between two date parameters passed. Also parameter expect value in either yymm or yyyymm format.