Showing posts with label properties. Show all posts
Showing posts with label properties. Show all posts

Friday, March 30, 2012

imitating nested "FOREACH" loop in SQL Query

Dear All,

I need to create a query to list all the subfolders within a folder.

I have a database table that lists the usual properties of each of the folder.

I have another database table that has two columns

1. Parent folder
2. Child folder

But this table maintains the parent child relationship only to one level.

For example if i have a folder X that has a subfolder Y and Z.
And Y has subfolders A and B.
and B has subfolder C and D
and C has subfolder E and F

The database table will look like

parentfolder child folder
X Y
X Z
Y A
Y B
B C
B D
C E
C F

I want to write a query which will take a folder name as the input and will provide me a list of all the folders and subfolders under it. The query should be based on the table (parent - child) and there should not be any restriction on the subfolder levels to search and report for.

I have been banging my head to do this but i have failed so far. Any help on this will be highly appreciated.

The APPLY operator will do what you need.

Check out:

http://msdn2.microsoft.com/en-us/library/ms175156.aspx

For a description and an example that pretty much is like your needs.

|||

In sql server 2005 you can use CTE..

Code Snippet

Create Table #folder (

[parentfolder] Varchar(100) ,

[childfolder] Varchar(100)

);

Insert Into #folder Values('X','Y');

Insert Into #folder Values('X','Z');

Insert Into #folder Values('Y','A');

Insert Into #folder Values('Y','B');

Insert Into #folder Values('B','C');

Insert Into #folder Values('B','D');

Insert Into #folder Values('C','E');

Insert Into #folder Values('C','F');

;With CTE([parentfolder],[childfolder],[Level],[Paths]) as

(

Select [parentfolder],[childfolder], 1 Level, Cast(Parentfolder + '\' + childfolder as varchar) Paths From #folder Where parentfolder = 'X'

UNION ALL

Select data.[parentfolder],data.[childfolder], Level + 1,Cast(Paths + '\' + data.[childfolder] as varchar)From #folder Data Join CTE On Data.ParentFolder = CTE.childfolder

)

Select * from CTE Order By Paths

|||Nicely done Mani!

Friday, March 23, 2012

image properties

Hello

Im having abit off trouble with my images positioning..

I have 3 images in the header placed side by side with a rectangle around them sent to the back

In layout view the images look correct, however when i deploy the report the rectangle appears on top and then the images appear undernealth each other...when they should be inside the rectangle. is there something like float on top properties similar to objects in Word?

A separate question, I also have a table to the right off the table i have an image and under that image another image...when i preview the report the second image is pushed to the bottom of where the table ends...is there someway to make the image appear side by side to the table instead off getting pushed down to the bottom...something similar to a frame in HTML ?

thanks

Yes, you are right SSRS 2005 has layers. You can put your image(s) on the top layer by simply right clicking on the image that you want to bring to the top and clicking "Bring to Front".

As far as your second question goes, I would try a rectangle tool to hold the table and the pictures next to it. Although I'm not quite sure if that will work because a rectangle can grow. I'll post something if I can think of another better idea.

|||

Hi

I think this is a problem due to the page width.

Right click on the report (the blank space below the report) and there you get Report properties.

In that report properties you will find Layout tab.

In the layout tab set increase the page width and also note to check for this

Page Width = Left Margin + Right margin + The report layout width.

Probly this will solve your problem.

|||

1. Make sure the images are inside of the rectangle, not just on top of them.

2. Our HTML renderer does not support overlapping items so make sure the images are not overlapping each other. Perhaps put a bit of space between them as a quick and simple test.

For question #2, have you tried putting the two images in a rectangle?

Thanks.

image properties

Hello

Im having abit off trouble with my images positioning..

I have 3 images in the header placed side by side with a rectangle around them sent to the back

In layout view the images look correct, however when i deploy the report the rectangle appears on top and then the images appear undernealth each other...when they should be inside the rectangle. is there something like float on top properties similar to objects in Word?

A separate question, I also have a table to the right off the table i have an image and under that image another image...when i preview the report the second image is pushed to the bottom of where the table ends...is there someway to make the image appear side by side to the table instead off getting pushed down to the bottom...something similar to a frame in HTML ?

thanks

Yes, you are right SSRS 2005 has layers. You can put your image(s) on the top layer by simply right clicking on the image that you want to bring to the top and clicking "Bring to Front".

As far as your second question goes, I would try a rectangle tool to hold the table and the pictures next to it. Although I'm not quite sure if that will work because a rectangle can grow. I'll post something if I can think of another better idea.

|||

Hi

I think this is a problem due to the page width.

Right click on the report (the blank space below the report) and there you get Report properties.

In that report properties you will find Layout tab.

In the layout tab set increase the page width and also note to check for this

Page Width = Left Margin + Right margin + The report layout width.

Probly this will solve your problem.

|||

1. Make sure the images are inside of the rectangle, not just on top of them.

2. Our HTML renderer does not support overlapping items so make sure the images are not overlapping each other. Perhaps put a bit of space between them as a quick and simple test.

For question #2, have you tried putting the two images in a rectangle?

Thanks.

sql

Sunday, February 19, 2012

IID_IDBInitialize interface of sql mobile 2005 problem in VisualStudio2005

Opening a connection to the database in Visual Studio 2005 and while closing the connection donot release the IID_IDBInitialize interface ,properties and not Uninitialising.

Try to open database file using CFile to check existence.

Works perfectly using sqlce2.0 & evc4.0 project.

After upgrading the above project to Visual Studio 2005

Same CFile open method fails at run time

But if close the connection completely i.e. close the IID_IDBInitialize interface also .Then it works perfectly in Visual Studio 2005.

Is there any change in IID_IDBInitialize interface of sql mobile 2005 ?

SQL Mobile *REALLY* commits the changes to DISK FILE at a default flush interval of 10 seconds. So, may be the database might have been created in RAM and is yet to be flushed to DISK and with in this flush interval, you might hit this problem.

Thanks,

Laxmi Narsimha Rao ORUGANTI, SQL Server Everywhere, Microsoft Corporation

|||

of course, this default interval (for commit transaction) could be changed and you could ask the SQL CE 3.0 engine to flush in real time (what we do in our development)


HTH,
Fabien.