Showing posts with label method. Show all posts
Showing posts with label method. Show all posts

Tuesday, March 27, 2012

Getting the format bar while using SSRS Web Service

Hi,

I am using the URL method to call reports where you get all the look and feel and report format and export options on the report page itself. When I tried to use the Web Service I couldn't find those options. I can render the reports only one format at a time. Is there anyway to view the reports as in URL methos using web service with all the formatting options? Thank You.

Regards,

Das.

The report toolbar is available only with URL addressability. If you need to use the Web Service, why don't use the Report Viewer controls? Behind the scenes, they call down to the Web service APIs.

getting tables size

Hi,
is there a method of getting table current size?
TIA!!
Hi
Have you looked at sp_spaceused ?
John
"z. f." wrote:

> Hi,
> is there a method of getting table current size?
> TIA!!
>
>
|||thanks!
is there a sample of using it in a loop for getting all tables information?
"John Bell" <JohnBell@.discussions.microsoft.com> wrote in message news:A7ABFB91-352A-4816-8601-51CAA844C8AC@.microsoft.com...
Hi
Have you looked at sp_spaceused ?
John
"z. f." wrote:

> Hi,
> is there a method of getting table current size?
> TIA!!
>
>
|||You could use Nigel's script:
http://www.nigelrivett.net/SQLAdmin/...dAllTables.htm
l
Rgds,
Paul Ibison (SQL Server MVP)
|||select object_name(id) as 'Table', used from sysindexes
Madhivanan
|||sp_MSForEachtable 'sp_spaceused ''?'''
Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com
"z. f." <zigi@.info-scopeREMSPAM.co.il> wrote in message news:OEDE0hjHFHA.2976@.TK2MSFTNGP15.phx.gbl...
thanks!
is there a sample of using it in a loop for getting all tables information?
"John Bell" <JohnBell@.discussions.microsoft.com> wrote in message news:A7ABFB91-352A-4816-8601-51CAA844C8AC@.microsoft.com...
Hi
Have you looked at sp_spaceused ?
John
"z. f." wrote:

> Hi,
> is there a method of getting table current size?
> TIA!!
>
>
|||Try my stored procedure, that lists the sizes of all tables or top n tables:
http://vyaskn.tripod.com/sp_show_biggest_tables.htm
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"z. f." <zigi@.info-scopeREMSPAM.co.il> wrote in message news:u8JdQ$iHFHA.3332@.TK2MSFTNGP15.phx.gbl...
Hi,
is there a method of getting table current size?
TIA!!

getting tables size

Hi,
is there a method of getting table current size?
TIA!!Hi
Have you looked at sp_spaceused ?
John
"z. f." wrote:

> Hi,
> is there a method of getting table current size?
> TIA!!
>
>|||thanks!
is there a sample of using it in a loop for getting all tables information?
"John Bell" <JohnBell@.discussions.microsoft.com> wrote in message news:A7ABF
B91-352A-4816-8601-51CAA844C8AC@.microsoft.com...
Hi
Have you looked at sp_spaceused ?
John
"z. f." wrote:

> Hi,
>
> is there a method of getting table current size?
>
> TIA!!
>
>
>|||
select object_name(id) as 'Table', used from sysindexes
Madhivanan|||sp_MSForEachtable 'sp_spaceused ''?'''
--
Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com
"z. f." <zigi@.info-scopeREMSPAM.co.il> wrote in message news:OEDE0hjHFHA.297
6@.TK2MSFTNGP15.phx.gbl...
thanks!
is there a sample of using it in a loop for getting all tables information?
"John Bell" <JohnBell@.discussions.microsoft.com> wrote in message news:A7ABF
B91-352A-4816-8601-51CAA844C8AC@.microsoft.com...
Hi
Have you looked at sp_spaceused ?
John
"z. f." wrote:

> Hi,
>
> is there a method of getting table current size?
>
> TIA!!
>
>
>|||Try my stored procedure, that lists the sizes of all tables or top n tables:
http://vyaskn.tripod.com/sp_show_biggest_tables.htm
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"z. f." <zigi@.info-scopeREMSPAM.co.il> wrote in message news:u8JdQ$iHFHA.333
2@.TK2MSFTNGP15.phx.gbl...
Hi,
is there a method of getting table current size?
TIA!!sql

getting tables size

Hi,
is there a method of getting table current size?
TIA!!Hi
Have you looked at sp_spaceused ?
John
"z. f." wrote:

> Hi,
> is there a method of getting table current size?
> TIA!!
>
>|||thanks!
is there a sample of using it in a loop for getting all tables information?
"John Bell" <JohnBell@.discussions.microsoft.com> wrote in message news:A7ABF
B91-352A-4816-8601-51CAA844C8AC@.microsoft.com...
Hi
Have you looked at sp_spaceused ?
John
"z. f." wrote:

> Hi,
>
> is there a method of getting table current size?
>
> TIA!!
>
>
>|||You could use Nigel's script:
http://www.nigelrivett.net/SQLAdmin...edAllTables.htm
l
Rgds,
Paul Ibison (SQL Server MVP)|||select object_name(id) as 'Table', used from sysindexes
Madhivanan|||sp_MSForEachtable 'sp_spaceused ''?'''
--
Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com
"z. f." <zigi@.info-scopeREMSPAM.co.il> wrote in message news:OEDE0hjHFHA.297
6@.TK2MSFTNGP15.phx.gbl...
thanks!
is there a sample of using it in a loop for getting all tables information?
"John Bell" <JohnBell@.discussions.microsoft.com> wrote in message news:A7ABF
B91-352A-4816-8601-51CAA844C8AC@.microsoft.com...
Hi
Have you looked at sp_spaceused ?
John
"z. f." wrote:

> Hi,
>
> is there a method of getting table current size?
>
> TIA!!
>
>
>|||Try my stored procedure, that lists the sizes of all tables or top n tables:
http://vyaskn.tripod.com/sp_show_biggest_tables.htm
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"z. f." <zigi@.info-scopeREMSPAM.co.il> wrote in message news:u8JdQ$iHFHA.333
2@.TK2MSFTNGP15.phx.gbl...
Hi,
is there a method of getting table current size?
TIA!!

Monday, March 12, 2012

Getting RecordCount with TableDirect

Hi, I would like to know if there's any method to get the total number of records in a table without using query. I have the following codes.



Dim conn As SqlServerCe.SqlCeConnection
Dim cmd As SqlServerCe.SqlCeCommand
Dim rdr As SqlServerCe.SqlCeDataReader

conn = New SqlServerCe.SqlCeConnection("Data source=\My Documents\test.sdf")
conn.Open()

cmd = New SqlServerCe.SqlCeCommand("Staff_Table", conn)
cmd.CommandType = CommandType.TableDirect
cmd.IndexName = "Id_Ind"

rdr = cmd.ExecuteReader
rdr.Seek(SqlServerCe.DbSeekOptions.FirstEqual, int_seek_n)

If rdr.Read() Then
strResult = rdr.GetString(1)
End If

rdr.Close()
conn.Close()

I did quite a bit of searching and got no results. Thanks.No, there's no shortcut to getting the count of rows in a table. I recommend doing a SELECT COUNT(*) and use ExecuteScalar to get the best performance on this query.

-Darren Shaffer|||Thanks Darren. Looks like I have no other choice. :)

Sunday, February 26, 2012

Getting JDBC metadata for synonyms

Using the Latest JDBC Driver from SQLExpress I'm attempting to get use the getTable() method to get information about database objects that the user can access/alter. Works fine for for tables and views, but can't seem to get any information returned for synonyms.

Is it possible to get information for synonyms, e.g. column definitions? or am I'm missing some setting in the connection.

Any Help would be appreciated!

Dave.

This a known issue and is being tracked by the SQL Server team. Can you describe the scenario for which you are usign synonyms? Are you able to owrk-around by using the table or view name?

|||Thanks for your reply,

The particular scenario we have is that we are developing a tool to create a Web Application from the database object definitions. We therefore, have no control over how the user has constructed his database and whether synonyms are used. We could get the data from the synonyms system table, but that would go against the design approach we have used. I will say that, unlike in Oracle, there seems to be no good reason to use synonyms in SQL Server at all, except possibly to enable the user to access different tables/views without changing code, which in my opinion, is a somewhat dubious practise anyway.

Dave

Getting JDBC metadata for synonyms

Using the Latest JDBC Driver from SQLExpress I'm attempting to get use the getTable() method to get information about database objects that the user can access/alter. Works fine for for tables and views, but can't seem to get any information returned for synonyms.

Is it possible to get information for synonyms, e.g. column definitions? or am I'm missing some setting in the connection.

Any Help would be appreciated!

Dave.

This a known issue and is being tracked by the SQL Server team. Can you describe the scenario for which you are usign synonyms? Are you able to owrk-around by using the table or view name?

|||Thanks for your reply,

The particular scenario we have is that we are developing a tool to create a Web Application from the database object definitions. We therefore, have no control over how the user has constructed his database and whether synonyms are used. We could get the data from the synonyms system table, but that would go against the design approach we have used. I will say that, unlike in Oracle, there seems to be no good reason to use synonyms in SQL Server at all, except possibly to enable the user to access different tables/views without changing code, which in my opinion, is a somewhat dubious practise anyway.

Dave

Getting Identity after Update method

I have a table recordset using rs.Open .....
I am adding records via
rs.AddNew
...
rs.Update
Is the new Identity value available immediately after the Update method, for
example
rs.Update
lngNewID = rs.RecordID
where RecordID is the Identity field. Thanks.
DavidDon't use AddNew, use an INSERT statement... or better yet, encapsulate it
in a stored procedure.
http://www.aspfaq.com/2174
http://www.aspfaq.com/2201
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.
"David C" <dlchase@.lifetimeinc.com> wrote in message
news:uElqca#KFHA.4092@.tk2msftngp13.phx.gbl...
> I have a table recordset using rs.Open .....
> I am adding records via
> rs.AddNew
> ...
> rs.Update
> Is the new Identity value available immediately after the Update method,
for
> example
> rs.Update
> lngNewID = rs.RecordID
> where RecordID is the Identity field. Thanks.
> David
>|||I agree and normally always use stored procs. However, I need to run
another function before I am done with this record that has to use the
new ID to populate one or more records in another table, return the
total and update the new record I am on.
David
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!|||> I agree and normally always use stored procs. However, I need to run
> another function before I am done with this record that has to use the
> new ID to populate one or more records in another table, return the
> total and update the new record I am on.
Why can't the stored procedure do this also? Or call another stored
procedure that does?
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.|||I don't understand why you can't do this with a proc but anyway you
should be able to retrieve the IDENTITY based on key value(s) for the
row you just added. IDENTITY should never be the only key of a table so
just use an alternate key:
SELECT id
FROM YourTable
WHERE key_col = <x>
Of course if you didn't declare an alternate key then you have other
problems too! :-)
David Portas
SQL Server MVP
--|||David,
You are correct, after update rs("ID_Col") will contain the newly inserted
id after Update is run.
-- Alex
"David C" wrote:

> I have a table recordset using rs.Open .....
> I am adding records via
> rs.AddNew
> ...
> rs.Update
> Is the new Identity value available immediately after the Update method, f
or
> example
> rs.Update
> lngNewID = rs.RecordID
> where RecordID is the Identity field. Thanks.
> David
>
>|||Mostly because the function that creates the related table records is
extremely complicated and conditional that it would take too long to
write and test it. This is an application that was ported from an
Access back end to SQL Server and I am under a time constraint so I have
to use as much existing code as possible. Hopefully, I'll have time to
analyze it later and maybe then I can convert to a stored proc(s), which
is my preference also.
p.s. The other function is a very complicated union dues calculation
that was set up for a government agency. Please try to understand.
Thanks
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!|||> Please try to understand.
I think I do understand. Reminds me of things like:
"Don't fix the leaking toilet. Just build a drain from your bathroom to the
reverse osmosis tank in the basement."|||That's a bit of a harsh analogy, don't you think ;-).
The ADO method has its advantages:
> quicker to develop & implement
> doesn't require create_proc permission in db (ie, doesn't involve getting
someone to grant those)
How about, "Wrap a bunch of ducttape around the pipe from the leaking
toilet" instead?
I'm sure it'll work just as well, but it isn't pretty and it isn't the right
way to do it ... but it's a heck of a lot cheaper.
-- Alex Papadimoulis
"Aaron [SQL Server MVP]" wrote:

> I think I do understand. Reminds me of things like:
> "Don't fix the leaking toilet. Just build a drain from your bathroom to t
he
> reverse osmosis tank in the basement."
>
>

Friday, February 24, 2012

Getting file names from path?

Hi,
Need some help here.
Is there a way to get a list of file names from the file system using T-SQL?
Or is there some other method (DTS or Setting up a linked server) which will
accomplish this? I need to provide a list of file names from a folder where
I will provide the path statement and SQL will return the file names that
exist within that particular folder. From there I can concatonate the path
with the file names then store the full path statements with file name into
a table.
Thanks in advance.
CurtYou can use sp_OA* methods to do this. Another option is to use xp_cmdshell
with a dir command like:
EXEC master..xp_cmdshell 'DIR C:\ /B'
Anith|||Hi
To add to Anith's suggestions you could write an ActiveX script in a similar
way to using the sp_OA* commands see http://www.sqldts.com/default.aspx?292
John
"Fishman" wrote:

> Hi,
> Need some help here.
> Is there a way to get a list of file names from the file system using T-SQ
L?
> Or is there some other method (DTS or Setting up a linked server) which wi
ll
> accomplish this? I need to provide a list of file names from a folder wher
e
> I will provide the path statement and SQL will return the file names that
> exist within that particular folder. From there I can concatonate the path
> with the file names then store the full path statements with file name int
o
> a table.
> Thanks in advance.
>
> Curt
>
>|||You could use a CLR TVF like so:
using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
using System.IO;
using System.Collections;
public partial class UserDefinedFunctions
{
/// <summary>
/// Returns a table with one column (Name) representing all files within
the path that match the criteria.
/// </summary>
/// <param name="path">The path to search. Can be relative</param>
/// <param name="searchPattern">The wildcard search pattern. Use "*" or
null for all.</param>
/// <param name="allDirectories">Search all directories under
path.</param>
/// <param name="includeFullPath">Include the full path in the
results.</param>
/// <returns>Table</returns>
[SqlFunction(FillRowMethodName = "FillFileNameRow", TableDefinition =
"Name nvarchar(300)")]
public static IEnumerable GetFileNames(string path, string
searchPattern, bool allDirectories, bool includeFullPath)
{
if (searchPattern == null)
searchPattern = "*";
string[] files = Directory.GetFiles(path, searchPattern,
allDirectories ? SearchOption.AllDirectories :
SearchOption.TopDirectoryOnly);
if (includeFullPath == false)
{
for (int i = 0; i < files.Length; i++)
{
files[i] = Path.GetFileName(files[i]);
}
}
return files;
}
/// <summary>
/// Break the row into columns for sql.
/// </summary>
public static void FillFileNameRow(object obj, out string Name)
{
string fn = (string)obj;
Name = fn;
}
};
Usage
--
select * from dbo.GetFileNames('c:', null, 0, 1)
Name
c:\AUTOEXEC.BAT
c:\boot.ini
c:\cmds.txt
c:\CONFIG.SYS
c:\dc100a.doc
c:\desktop.ini
...
William Stacey [MVP]
"Fishman" <qwpit@.kcnet.com> wrote in message
news:OWdCp5aJGHA.1676@.TK2MSFTNGP09.phx.gbl...
| Hi,
|
| Need some help here.
| Is there a way to get a list of file names from the file system using
T-SQL?
| Or is there some other method (DTS or Setting up a linked server) which
will
| accomplish this? I need to provide a list of file names from a folder
where
| I will provide the path statement and SQL will return the file names that
| exist within that particular folder. From there I can concatonate the path
| with the file names then store the full path statements with file name
into
| a table.
|
| Thanks in advance.
|
|
| Curt
|
||||You can use the FileSystemObject to enumerate a list of files. This example
is within the context of Office VBA scripting, but the syxtax for using it
with a DTS package / VBScript Task would be very similar if not the same.
http://msdn.microsoft.com/library/d...mfilesystem.asp
"Fishman" <qwpit@.kcnet.com> wrote in message
news:OWdCp5aJGHA.1676@.TK2MSFTNGP09.phx.gbl...
> Hi,
> Need some help here.
> Is there a way to get a list of file names from the file system using
> T-SQL?
> Or is there some other method (DTS or Setting up a linked server) which
> will
> accomplish this? I need to provide a list of file names from a folder
> where
> I will provide the path statement and SQL will return the file names that
> exist within that particular folder. From there I can concatonate the path
> with the file names then store the full path statements with file name
> into
> a table.
> Thanks in advance.
>
> Curt
>