Showing posts with label function. Show all posts
Showing posts with label function. Show all posts

Tuesday, March 27, 2012

Filter and Except Function

Can any one quickly explain me the difference between the two?

I have a cube which contains dimensions such as REGION , MARKET,PRODUCT etc. While I cretaed this cube the ALL level was populated in cube as I did not have any control over it. I want to access the OLAP data with the MDX. I am trying something like this but its not working.Any suggestions?

strSource = "With "
strSource = strSource & " member REGION.region_all as 'aggregate({except({[REGION].members},{[REGION].[ALL]})})'"
strSource = strSource & " member market.market_all as 'aggregate({except({[market].members},{[market].[ALL]})})'"
strSource = strSource & " member PRODUCT.product_all as 'aggregate({except({[PRODUCT].members},{[PRODUCT].[ALL]})})'"
strSource = strSource & "SELECT "
strSource = strSource & "{[Measures].members} ON COLUMNS,"
strSource = strSource & _
"NON EMPTY [METRIC].members ON ROWS"
strSource = strSource & " FROM ocwcube"
strSource = strSource & " where (region_all,market_all ,product_all)"
Debug.Print strSource

Can you describe the desired layout of results in more detail - it's not clear what you want from the above code? Also, for simplicity, you might want to first debug the MDX query in a tool like Management Studio, then develop the code to construct it.sql

Filter and Aggregat function

Hi all,
I am creating a report in BI Dev Studio and use the grouping
functionality to show the number of leads for different sales
representatives. I also use "drill down" to show the leads in detail.
The report also uses a filter to filter out certain time period.
On the sales persons level I use "Rowcount" to show the number of
leads. this works fine as long as I do not use any filter. If I use the
filter, the "Rowcount" function still shows the number of leads for the
whole table, although the sub-group shows the right number of entries.
Where is my mistake?You could place your filter in the WHERE statement under the data tab.
<leebm@.sms.at> wrote in message
news:1156789789.405721.156960@.h48g2000cwc.googlegroups.com...
> Hi all,
> I am creating a report in BI Dev Studio and use the grouping
> functionality to show the number of leads for different sales
> representatives. I also use "drill down" to show the leads in detail.
> The report also uses a filter to filter out certain time period.
> On the sales persons level I use "Rowcount" to show the number of
> leads. this works fine as long as I do not use any filter. If I use the
> filter, the "Rowcount" function still shows the number of leads for the
> whole table, although the sub-group shows the right number of entries.
> Where is my mistake?
>|||Ben Watts schrieb:
> You could place your filter in the WHERE statement under the data tab.
> <leebm@.sms.at> wrote in message
> news:1156789789.405721.156960@.h48g2000cwc.googlegroups.com...
> > Hi all,
> > I am creating a report in BI Dev Studio and use the grouping
> > functionality to show the number of leads for different sales
> > representatives. I also use "drill down" to show the leads in detail.
> > The report also uses a filter to filter out certain time period.
> > On the sales persons level I use "Rowcount" to show the number of
> > leads. this works fine as long as I do not use any filter. If I use the
> > filter, the "Rowcount" function still shows the number of leads for the
> > whole table, although the sub-group shows the right number of entries.
> >
> > Where is my mistake?
> >
Thanks for the answer, but how do I place the filter in the sql
statment exactly? I tried something like: select * from
Adressenherkunft where insertdate = 'Parameters!von.Value' but this
does not work?|||Hi,
The syntax is like
insertdate = @.von
where "von" is the name of the parameter exactly as it shows in the report
parameters dialogbox.
HTH,
Jordi Rambla
MVP SQL Server (Reporting Services)
Solid Quality Learning (http://www.solidqualitylearning.com)
"Markus" <leebm@.sms.at> escribió en el mensaje
news:1156850392.248071.158990@.75g2000cwc.googlegroups.com...
> Ben Watts schrieb:
>> You could place your filter in the WHERE statement under the data tab.
>> <leebm@.sms.at> wrote in message
>> news:1156789789.405721.156960@.h48g2000cwc.googlegroups.com...
>> > Hi all,
>> > I am creating a report in BI Dev Studio and use the grouping
>> > functionality to show the number of leads for different sales
>> > representatives. I also use "drill down" to show the leads in detail.
>> > The report also uses a filter to filter out certain time period.
>> > On the sales persons level I use "Rowcount" to show the number of
>> > leads. this works fine as long as I do not use any filter. If I use the
>> > filter, the "Rowcount" function still shows the number of leads for the
>> > whole table, although the sub-group shows the right number of entries.
>> >
>> > Where is my mistake?
>> >
> Thanks for the answer, but how do I place the filter in the sql
> statment exactly? I tried something like: select * from
> Adressenherkunft where insertdate = 'Parameters!von.Value' but this
> does not work?
>

Friday, March 23, 2012

FileTime

Is there a SQL function to get FileTime?
Filetime is a 64 bit number representing time(up to nano seconds) from
January 1, 1601 to what ever the time right now.
In C++/C# etc, you have functions to get his value or to convert file time
in system time. Ex;: Getfiletime()
FileTime 127512288251260000 is equivalent to '2005/01/26 16:00:25.126'
"Rick Sawtell" wrote:

> "uhway" <uhway@.discussions.microsoft.com> wrote in message
> news:B53A17CF-BFE1-4B37-8D0E-466859C445C8@.microsoft.com...
>
> What do you mean by filetime? Can you give an example of what the filetime
> data looks like?
>
> Rick Sawtell
> MCT, MCSD, MCDBA
>
>
You can use DATEDIFF(ms,startdate, GETDATE())
where ms stands for milliseconds, startdate is a your own starting date, and
getdate is the system function that returns the current date, up to
milliseconds.
Francesco Anti
"uhway" <uhway@.discussions.microsoft.com> wrote in message
news:E0DD2F8B-F244-435D-99A5-105D368AC8D6@.microsoft.com...[vbcol=seagreen]
> Is there a SQL function to get FileTime?
> Filetime is a 64 bit number representing time(up to nano seconds) from
> January 1, 1601 to what ever the time right now.
> In C++/C# etc, you have functions to get his value or to convert file time
> in system time. Ex;: Getfiletime()
> FileTime 127512288251260000 is equivalent to '2005/01/26 16:00:25.126'
> "Rick Sawtell" wrote:
filetime
>
|||One thing to remember is that since SQL Server DateTime has less reolution,
you can do a direct comparison.
"Francesco Anti" <fanti @. sicosbt.it> wrote in message
news:ed2YskSBFHA.608@.TK2MSFTNGP15.phx.gbl...
> You can use DATEDIFF(ms,startdate, GETDATE())
> where ms stands for milliseconds, startdate is a your own starting date,
and[vbcol=seagreen]
> getdate is the system function that returns the current date, up to
> milliseconds.
> Francesco Anti
> "uhway" <uhway@.discussions.microsoft.com> wrote in message
> news:E0DD2F8B-F244-435D-99A5-105D368AC8D6@.microsoft.com...
time
> filetime
>

FileTime

Is there a sql function for FileTime?
Filetime is a 64 bit number representing time(up to nano seconds) from
January 1, 1601 to what ever the time right now.
In C++/C# etc, you have functions to get his value or to convert file time
in system time. Ex;: Getfiletime()
FileTime 127512288251260000 is equivalent to '2005/01/26 16:00:25.126'
"Rick Sawtell" wrote:

> "uhway" <uhway@.discussions.microsoft.com> wrote in message
> news:B53A17CF-BFE1-4B37-8D0E-466859C445C8@.microsoft.com...
>
> What do you mean by filetime? Can you give an example of what the filetime
> data looks like?
>
> Rick Sawtell
> MCT, MCSD, MCDBA
>
>
No, not built-in; I guess the only way would be to create your own UDF.
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com
"uhway" <uhway@.discussions.microsoft.com> wrote in message
news:755BB301-090D-4D92-94E1-30D91A112A10@.microsoft.com...[vbcol=seagreen]
> Is there a sql function for FileTime?
>
> Filetime is a 64 bit number representing time(up to nano seconds) from
> January 1, 1601 to what ever the time right now.
> In C++/C# etc, you have functions to get his value or to convert file time
> in system time. Ex;: Getfiletime()
> FileTime 127512288251260000 is equivalent to '2005/01/26 16:00:25.126'
> "Rick Sawtell" wrote:
filetime
>

FileTime

Is there a SQL function to get FileTime?
Filetime is a 64 bit number representing time(up to nano seconds) from
January 1, 1601 to what ever the time right now.
In C++/C# etc, you have functions to get his value or to convert file time
in system time. Ex;: Getfiletime()
FileTime 127512288251260000 is equivalent to '2005/01/26 16:00:25.126'
"Rick Sawtell" wrote:

> "uhway" <uhway@.discussions.microsoft.com> wrote in message
> news:B53A17CF-BFE1-4B37-8D0E-466859C445C8@.microsoft.com...
>
> What do you mean by filetime? Can you give an example of what the fileti
me
> data looks like?
>
> Rick Sawtell
> MCT, MCSD, MCDBA
>
>You can use DATEDIFF(ms,startdate, GETDATE())
where ms stands for milliseconds, startdate is a your own starting date, and
getdate is the system function that returns the current date, up to
milliseconds.
Francesco Anti
"uhway" <uhway@.discussions.microsoft.com> wrote in message
news:E0DD2F8B-F244-435D-99A5-105D368AC8D6@.microsoft.com...
> Is there a SQL function to get FileTime?
> Filetime is a 64 bit number representing time(up to nano seconds) from
> January 1, 1601 to what ever the time right now.
> In C++/C# etc, you have functions to get his value or to convert file time
> in system time. Ex;: Getfiletime()
> FileTime 127512288251260000 is equivalent to '2005/01/26 16:00:25.126'
> "Rick Sawtell" wrote:
>
filetime[vbcol=seagreen]
>|||One thing to remember is that since SQL Server DateTime has less reolution,
you can do a direct comparison.
"Francesco Anti" <fanti @. sicosbt.it> wrote in message
news:ed2YskSBFHA.608@.TK2MSFTNGP15.phx.gbl...
> You can use DATEDIFF(ms,startdate, GETDATE())
> where ms stands for milliseconds, startdate is a your own starting date,
and
> getdate is the system function that returns the current date, up to
> milliseconds.
> Francesco Anti
> "uhway" <uhway@.discussions.microsoft.com> wrote in message
> news:E0DD2F8B-F244-435D-99A5-105D368AC8D6@.microsoft.com...
time[vbcol=seagreen]
> filetime
>

FileTime

Is there a sql function for FileTime?
Filetime is a 64 bit number representing time(up to nano seconds) from
January 1, 1601 to what ever the time right now.
In C++/C# etc, you have functions to get his value or to convert file time
in system time. Ex;: Getfiletime()
FileTime 127512288251260000 is equivalent to '2005/01/26 16:00:25.126'
"Rick Sawtell" wrote:

> "uhway" <uhway@.discussions.microsoft.com> wrote in message
> news:B53A17CF-BFE1-4B37-8D0E-466859C445C8@.microsoft.com...
>
> What do you mean by filetime? Can you give an example of what the fileti
me
> data looks like?
>
> Rick Sawtell
> MCT, MCSD, MCDBA
>
>No, not built-in; I guess the only way would be to create your own UDF.
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com
"uhway" <uhway@.discussions.microsoft.com> wrote in message
news:755BB301-090D-4D92-94E1-30D91A112A10@.microsoft.com...
> Is there a sql function for FileTime?
>
> Filetime is a 64 bit number representing time(up to nano seconds) from
> January 1, 1601 to what ever the time right now.
> In C++/C# etc, you have functions to get his value or to convert file time
> in system time. Ex;: Getfiletime()
> FileTime 127512288251260000 is equivalent to '2005/01/26 16:00:25.126'
> "Rick Sawtell" wrote:
>
filetime[vbcol=seagreen]
>sql

FileTime

Is there a sql function for FileTime?
Filetime is a 64 bit number representing time(up to nano seconds) from
January 1, 1601 to what ever the time right now.
In C++/C# etc, you have functions to get his value or to convert file time
in system time. Ex;: Getfiletime()
FileTime 127512288251260000 is equivalent to '2005/01/26 16:00:25.126'
"Rick Sawtell" wrote:
>
> "uhway" <uhway@.discussions.microsoft.com> wrote in message
> news:B53A17CF-BFE1-4B37-8D0E-466859C445C8@.microsoft.com...
> > How can I convert filetime to datetime in sql server inside a sored
> > procedure.
> >
> > Thanks
> > BVR
>
>
> What do you mean by filetime? Can you give an example of what the filetime
> data looks like?
>
>
> Rick Sawtell
> MCT, MCSD, MCDBA
>
>
>
>No, not built-in; I guess the only way would be to create your own UDF.
--
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com
"uhway" <uhway@.discussions.microsoft.com> wrote in message
news:755BB301-090D-4D92-94E1-30D91A112A10@.microsoft.com...
> Is there a sql function for FileTime?
>
> Filetime is a 64 bit number representing time(up to nano seconds) from
> January 1, 1601 to what ever the time right now.
> In C++/C# etc, you have functions to get his value or to convert file time
> in system time. Ex;: Getfiletime()
> FileTime 127512288251260000 is equivalent to '2005/01/26 16:00:25.126'
> "Rick Sawtell" wrote:
> >
> > "uhway" <uhway@.discussions.microsoft.com> wrote in message
> > news:B53A17CF-BFE1-4B37-8D0E-466859C445C8@.microsoft.com...
> > > How can I convert filetime to datetime in sql server inside a sored
> > > procedure.
> > >
> > > Thanks
> > > BVR
> >
> >
> > What do you mean by filetime? Can you give an example of what the
filetime
> > data looks like?
> >
> >
> > Rick Sawtell
> > MCT, MCSD, MCDBA
> >
> >
> >
> >
>

Wednesday, March 21, 2012

fileLen function in stored procedure

Heres an extract of a stored procedure creating a column.
Path = FileLen([CacheServers].[CachePath]+
(left([DOCUMENT]. [PHYSICAL_DOC_GUID],6))+''''+[DOCUMENT]
.[PHYSICAL_DOC_GUID]+[DOCUMENT].[FileType])
Reult:
\\comp-ap- 70c\Imxxs$\data\docs\70393C\70393CE0EC6D
11D8BB64000D568A4637.tif
The above is a file path of an image stored on the SAN server. The code
above works perfectly fine in MS Access but not in SQL server 2K
It should return the size in bytes of the file.
Books online state the VBA function fileLen() works in SQL Analyser,
however, when I execute the stored procedure I receive an error message
"FileLen is not a recognised function name".
I cant find a thing on the Microsoft Tech communities the specifically
relates to calling VBA functions in SQL.
Any ideas?
Learning SQL and AccessIs there something wrong with the LEN function? Or DATALENGTH?
MC
"sebastian stephenson" <sebastianstephenson@.discussions.microsoft.com> wrote
in message news:E9F88AB0-05A3-4BE6-9EB0-6314A7685359@.microsoft.com...
> Heres an extract of a stored procedure creating a column.
> Path = FileLen([CacheServers].[CachePath]+
> (left([DOCUMENT]. [PHYSICAL_DOC_GUID],6))+''''+[DOCUMENT]
.[PHYSICAL_DOC_GUID]+[DOCUMENT].[FileType])
> Reult:
> \\comp-ap- 70c\Imxxs$\data\docs\70393C\70393CE0EC6D
11D8BB64000D568A4637.tif
> The above is a file path of an image stored on the SAN server. The code
> above works perfectly fine in MS Access but not in SQL server 2K
> It should return the size in bytes of the file.
> Books online state the VBA function fileLen() works in SQL Analyser,
> however, when I execute the stored procedure I receive an error message
> "FileLen is not a recognised function name".
> I cant find a thing on the Microsoft Tech communities the specifically
> relates to calling VBA functions in SQL.
> Any ideas?
> --
> Learning SQL and Access|||> Books online state the VBA function fileLen() works in SQL Analyser,
> however, when I execute the stored procedure I receive an error message
Where does it say that?
If you really need to check for file sizes from T-SQL you should look at the
sp_OA* system procedures. I'd suggest using an appropriate client applicatio
n
to supply the values to the server.
ML
http://milambda.blogspot.com/|||I obviously didnt understand you correctly. Is SQL Server 2005 an option?
You could use CLR for something like this.
MC
"MC" <marko_culo#@.#yahoo#.#com#> wrote in message
news:u%23FgSFLVGHA.524@.TK2MSFTNGP10.phx.gbl...
> Is there something wrong with the LEN function? Or DATALENGTH?
>
> MC
>
> "sebastian stephenson" <sebastianstephenson@.discussions.microsoft.com>
> wrote in message
> news:E9F88AB0-05A3-4BE6-9EB0-6314A7685359@.microsoft.com...
>

Monday, March 12, 2012

filegroup is offline after restore

I am using SQL-2005 Beta. I created 7 filegroups and associate them to
a table "Myhour" through partition function and schema. It works fine.
Then I tried the following statements to backup and retore the first
filegroup:
BACKUP DATABASE Mydb
FILE='20050204' -- my first filegroup
TO DISK='C:\backup\20050204.bak'
GO
RESTORE DATABASE Mydb FROM DISK='C:\backup\20050204.bak'
GO
The execution is OK. However, after that, I could not access data from
Myhour table:
SELECT * from Myhour
GO
The error message is that '20050204' filegroup is offline. I tried
many ways. I could not figure out how to bring this filegroup online.
I event tried to remove the filegroup. I got the same offline message.
Any way to bring filegroup online?
David Chu
Information regarding filegroup restore is available in Books Online. Basically, you restored part
of the database to an earlier point in time. You don't want SQL Server to be all happy and let you
use this possibly inconsistent database? So you need to apply the transaction log backups since the
database backup was performed so that SQL Server can re-apply the work that has been performed for
that filegroup. New for SQL Server 2005 is that you can set that filegroup to read-only (before the
backup and not change it back to read write) and then restore of transaction logs are not necessary
as SQL Server would know that no data has been changed in the filegroup.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"David Chu" <chudq@.hotmail.com> wrote in message
news:ec313994.0502090925.2966a624@.posting.google.c om...
>I am using SQL-2005 Beta. I created 7 filegroups and associate them to
> a table "Myhour" through partition function and schema. It works fine.
> Then I tried the following statements to backup and retore the first
> filegroup:
> BACKUP DATABASE Mydb
> FILE='20050204' -- my first filegroup
> TO DISK='C:\backup\20050204.bak'
> GO
> RESTORE DATABASE Mydb FROM DISK='C:\backup\20050204.bak'
> GO
> The execution is OK. However, after that, I could not access data from
> Myhour table:
> SELECT * from Myhour
> GO
> The error message is that '20050204' filegroup is offline. I tried
> many ways. I could not figure out how to bring this filegroup online.
> I event tried to remove the filegroup. I got the same offline message.
> Any way to bring filegroup online?
> David Chu
|||OK. I may do something not correctly to restore filegroup. For my
current position, is there way to bring my offline filegroup
(20050204) back on line? Without it back on line, I could not do
anything about my table Myhour because 20050204 is a partition of the
table.
|||Try backing up the transaction log, restore the file group and then restore the transaction log
backup. But check Books Online first. It was a while since I worked with filegroup backup and
restore, so I might be a bit rusty on the details.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"David Chu" <chudq@.hotmail.com> wrote in message
news:ec313994.0502100818.72e989f3@.posting.google.c om...
> OK. I may do something not correctly to restore filegroup. For my
> current position, is there way to bring my offline filegroup
> (20050204) back on line? Without it back on line, I could not do
> anything about my table Myhour because 20050204 is a partition of the
> table.

filegroup is offline after restore

I am using SQL-2005 Beta. I created 7 filegroups and associate them to
a table "Myhour" through partition function and schema. It works fine.
Then I tried the following statements to backup and retore the first
filegroup:
BACKUP DATABASE Mydb
FILE='20050204' -- my first filegroup
TO DISK='C:\backup\20050204.bak'
GO
RESTORE DATABASE Mydb FROM DISK='C:\backup\20050204.bak'
GO
The execution is OK. However, after that, I could not access data from
Myhour table:
SELECT * from Myhour
GO
The error message is that '20050204' filegroup is offline. I tried
many ways. I could not figure out how to bring this filegroup online.
I event tried to remove the filegroup. I got the same offline message.
Any way to bring filegroup online?
David ChuInformation regarding filegroup restore is available in Books Online. Basica
lly, you restored part
of the database to an earlier point in time. You don't want SQL Server to be
all happy and let you
use this possibly inconsistent database? So you need to apply the transactio
n log backups since the
database backup was performed so that SQL Server can re-apply the work that
has been performed for
that filegroup. New for SQL Server 2005 is that you can set that filegroup t
o read-only (before the
backup and not change it back to read write) and then restore of transaction
logs are not necessary
as SQL Server would know that no data has been changed in the filegroup.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"David Chu" <chudq@.hotmail.com> wrote in message
news:ec313994.0502090925.2966a624@.posting.google.com...
>I am using SQL-2005 Beta. I created 7 filegroups and associate them to
> a table "Myhour" through partition function and schema. It works fine.
> Then I tried the following statements to backup and retore the first
> filegroup:
> BACKUP DATABASE Mydb
> FILE='20050204' -- my first filegroup
> TO DISK='C:\backup\20050204.bak'
> GO
> RESTORE DATABASE Mydb FROM DISK='C:\backup\20050204.bak'
> GO
> The execution is OK. However, after that, I could not access data from
> Myhour table:
> SELECT * from Myhour
> GO
> The error message is that '20050204' filegroup is offline. I tried
> many ways. I could not figure out how to bring this filegroup online.
> I event tried to remove the filegroup. I got the same offline message.
> Any way to bring filegroup online?
> David Chu|||OK. I may do something not correctly to restore filegroup. For my
current position, is there way to bring my offline filegroup
(20050204) back on line? Without it back on line, I could not do
anything about my table Myhour because 20050204 is a partition of the
table.|||Try backing up the transaction log, restore the file group and then restore
the transaction log
backup. But check Books Online first. It was a while since I worked with fil
egroup backup and
restore, so I might be a bit rusty on the details.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"David Chu" <chudq@.hotmail.com> wrote in message
news:ec313994.0502100818.72e989f3@.posting.google.com...
> OK. I may do something not correctly to restore filegroup. For my
> current position, is there way to bring my offline filegroup
> (20050204) back on line? Without it back on line, I could not do
> anything about my table Myhour because 20050204 is a partition of the
> table.

filegroup is offline after restore

I am using SQL-2005 Beta. I created 7 filegroups and associate them to
a table "Myhour" through partition function and schema. It works fine.
Then I tried the following statements to backup and retore the first
filegroup:
BACKUP DATABASE Mydb
FILE='20050204' -- my first filegroup
TO DISK='C:\backup\20050204.bak'
GO
RESTORE DATABASE Mydb FROM DISK='C:\backup\20050204.bak'
GO
The execution is OK. However, after that, I could not access data from
Myhour table:
SELECT * from Myhour
GO
The error message is that '20050204' filegroup is offline. I tried
many ways. I could not figure out how to bring this filegroup online.
I event tried to remove the filegroup. I got the same offline message.
Any way to bring filegroup online?
David ChuInformation regarding filegroup restore is available in Books Online. Basically, you restored part
of the database to an earlier point in time. You don't want SQL Server to be all happy and let you
use this possibly inconsistent database? So you need to apply the transaction log backups since the
database backup was performed so that SQL Server can re-apply the work that has been performed for
that filegroup. New for SQL Server 2005 is that you can set that filegroup to read-only (before the
backup and not change it back to read write) and then restore of transaction logs are not necessary
as SQL Server would know that no data has been changed in the filegroup.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"David Chu" <chudq@.hotmail.com> wrote in message
news:ec313994.0502090925.2966a624@.posting.google.com...
>I am using SQL-2005 Beta. I created 7 filegroups and associate them to
> a table "Myhour" through partition function and schema. It works fine.
> Then I tried the following statements to backup and retore the first
> filegroup:
> BACKUP DATABASE Mydb
> FILE='20050204' -- my first filegroup
> TO DISK='C:\backup\20050204.bak'
> GO
> RESTORE DATABASE Mydb FROM DISK='C:\backup\20050204.bak'
> GO
> The execution is OK. However, after that, I could not access data from
> Myhour table:
> SELECT * from Myhour
> GO
> The error message is that '20050204' filegroup is offline. I tried
> many ways. I could not figure out how to bring this filegroup online.
> I event tried to remove the filegroup. I got the same offline message.
> Any way to bring filegroup online?
> David Chu|||OK. I may do something not correctly to restore filegroup. For my
current position, is there way to bring my offline filegroup
(20050204) back on line? Without it back on line, I could not do
anything about my table Myhour because 20050204 is a partition of the
table.|||Try backing up the transaction log, restore the file group and then restore the transaction log
backup. But check Books Online first. It was a while since I worked with filegroup backup and
restore, so I might be a bit rusty on the details.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"David Chu" <chudq@.hotmail.com> wrote in message
news:ec313994.0502100818.72e989f3@.posting.google.com...
> OK. I may do something not correctly to restore filegroup. For my
> current position, is there way to bring my offline filegroup
> (20050204) back on line? Without it back on line, I could not do
> anything about my table Myhour because 20050204 is a partition of the
> table.

Sunday, February 26, 2012

File size big when download report

Hi
I download my report using SQL Server Reporting service export function
(excel format), The file size is very big, when compare to my previous asp
download function.
Note: The no of rec is same.
Ex: Using ASP, the file size is about 1000 kb
Using RS, the file size is about 23,000 kb.
Pls help me, what should I do to reduce the file size to normal.
Thanks
Regards
Kumar.Are you using SP1 version of RS? SP1 introduced excel using its native
store, while RTM used MHTML which was much larger.
--
-Daniel
This posting is provided "AS IS" with no warranties, and confers no rights.
"Kumar" <Kumar@.discussions.microsoft.com> wrote in message
news:5126C810-2785-4B32-A46C-6FB085FCAADD@.microsoft.com...
> Hi
> I download my report using SQL Server Reporting service export function
> (excel format), The file size is very big, when compare to my previous asp
> download function.
> Note: The no of rec is same.
> Ex: Using ASP, the file size is about 1000 kb
> Using RS, the file size is about 23,000 kb.
> Pls help me, what should I do to reduce the file size to normal.
> Thanks
> Regards
> Kumar.
>

Sunday, February 19, 2012

file handling

Is there function in SQL to return just the filename. For eg.
if the filename is 'C:\test\job.txt' , i want to extract job from the
filename. Is is possible? Thanks in advance!There's nothing built-in but you can accomplish the desired result with some
Transact-SQL string functions:
DECLARE @.FilePath varchar(255)
SET @.FilePath = 'C:\test\job.txt'
SELECT REVERSE(LEFT(REVERSE(@.FilePath), CHARINDEX('',
REVERSE(@.FilePath))-1))
Hope this helps.
Dan Guzman
SQL Server MVP
"HP" <HP@.discussions.microsoft.com> wrote in message
news:9368C79B-35DF-4D68-9A56-E97613D74416@.microsoft.com...
> Is there function in SQL to return just the filename. For eg.
> if the filename is 'C:\test\job.txt' , i want to extract job from the
> filename. Is is possible? Thanks in advance!|||HP,
If the path is stored in a column, the T-SQL string functions (i.e.,
CHARINDEX, SUBSTRING, etc...) can be used to return just the name. Also,
there are a few undocumented extended stored procedures that can be used to
work with files using T-SQL.
HTH
Jerry
"HP" <HP@.discussions.microsoft.com> wrote in message
news:9368C79B-35DF-4D68-9A56-E97613D74416@.microsoft.com...
> Is there function in SQL to return just the filename. For eg.
> if the filename is 'C:\test\job.txt' , i want to extract job from the
> filename. Is is possible? Thanks in advance!|||Thanks!
"Jerry Spivey" wrote:

> HP,
> If the path is stored in a column, the T-SQL string functions (i.e.,
> CHARINDEX, SUBSTRING, etc...) can be used to return just the name. Also,
> there are a few undocumented extended stored procedures that can be used t
o
> work with files using T-SQL.
> HTH
> Jerry
> "HP" <HP@.discussions.microsoft.com> wrote in message
> news:9368C79B-35DF-4D68-9A56-E97613D74416@.microsoft.com...
>
>