Friday, March 23, 2012
Retrieving total number of pages
looked at the expression functions and couldn't see anything to do
that.="Page " & Globals!PageNumber & " of " & Globals!TotalPages
Reeves
"Doogie" wrote:
> How do I - inside my report, display the total number of pages? I
> looked at the expression functions and couldn't see anything to do
> that.
>
Tuesday, March 20, 2012
retrieving long texts from msqql
column. When I take a look directly inside the database, I can see
that there exists more data than I get when running the select query.
How can I get all the data retrieved?
obscurrHi,
If you're using Query Analyzer, it truncates output at 255 characters.
Don't worry about it, the output is all there. Tricky microsofties.
-- Louis|||But if I want to put it in a textarea on my php page, the whole thing
doesn't show. How am I able to do that?
obscurr
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!|||louisducnguyen@.hotmail.com (louis nguyen) wrote in message news:<b0e9d53.0311220909.67236875@.posting.google.com>...
> Hi,
> If you're using Query Analyzer, it truncates output at 255 characters.
> Don't worry about it, the output is all there. Tricky microsofties.
> -- Louis
If that is your issue, you can increase the number of characters
displayed in QA, to a maximum of 8192 (Tools - Options - Results).
Simon
Wednesday, March 7, 2012
Retrieve table names
How can I get a list of the names of the tables inside a database?
The following command will do that trick:
Code Snippet
SELECT * FROM INFORMATION_SCHEMA.TABLES
Tuesday, February 21, 2012
retrieve columns information on a different database table
Here is my situation:
I have a stored procedure in my first database and inside it I need to
retrieve column names of a table located in a different database. The
database name and the table name are provided as sysname parameters to my
stored procedure.
How do I query the INFORMATION_SCHEMA.COLUMNS from a different database?
Kind regards,
ConstantinYou can qualify the INFORMATION_SCHEMA.COLUMNS view with a database name.
Linchi
"Constantin Stan" wrote:
> Hi guys!
> Here is my situation:
> I have a stored procedure in my first database and inside it I need to
> retrieve column names of a table located in a different database. The
> database name and the table name are provided as sysname parameters to my
> stored procedure.
> How do I query the INFORMATION_SCHEMA.COLUMNS from a different database?
>
> Kind regards,
> Constantin
>
>|||Hi Linchi!
How may I qualify the name?
I tried something with @.FullSourceTableName but you may not select from that
name. It should be a table. It seems I missed some tsql classes.
Apreciate your help!
PS: this is my stored procedure:
ALTER PROCEDURE [dbo].[usp_CreateReportLocalizationForObject]
@.SourceDB as sysname,
@.SourceTable as sysname,
@.Culture varchar(10)
AS
BEGIN
-- i'm looking for something like this. but it doesn't work
declare @.FullSourceTableName sysname
set @.FullSourceTableName =OBJECT_NAME(OBJECT_ID('INFORMATION_SCHEMA.COLUMNS'), DB_ID(@.SourceDB));
print @.FullSourceTableName
-- open cursor to loop the columns list returned as a resultset
declare ColumnsList cursor for (select COLUMN_NAME from
INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = @.SourceTable)
open ColumnsList
-- loop records
declare @.ColumnName sysname
fetch next from ColumnsList into @.ColumnName
while (@.@.FETCH_STATUS = 0)
begin
-- if there is no record for this column, then insert, otherwise do nothing!
-- put a default value for DisplayName and Status
if not exists(select * from ReportLocalization where
((ViewName=@.SourceTable) AND (ColumnName=@.ColumnName) AND
(Culture=@.Culture)))
begin
INSERT INTO [ReportLocalization]
(ViewName,[ColumnName],[Culture],[DisplayName],[DisplayCategory],[Status])
VALUES (@.SourceTable, @.ColumnName, @.Culture, @.ColumnName, '', 'active')
end
fetch next from ColumnsList into @.ColumnName
end
-- close cursor and deallocate resources
close ColumnsList
deallocate ColumnsList
-- insert a record for the view name, with ColumnName as empty string, and
default value for DisplayName as SourceTable
if not exists(select * from ReportLocalization where
((ViewName=@.SourceTable) AND (ColumnName='') AND (Culture=@.Culture)))
begin
INSERT INTO [ReportLocalization]
(ViewName,[ColumnName],[Culture],[DisplayName],[DisplayCategory],[Status])
VALUES (@.SourceTable, '', @.Culture, @.SourceTable, '', 'active')
end
-- Return to caller
--
RETURN 0
END
"Linchi Shea" <LinchiShea@.discussions.microsoft.com> wrote in message
news:A850A318-5925-4BF1-B0C6-D4E3BB64EB05@.microsoft.com...
> You can qualify the INFORMATION_SCHEMA.COLUMNS view with a database name.
> Linchi
> "Constantin Stan" wrote:
>> Hi guys!
>> Here is my situation:
>> I have a stored procedure in my first database and inside it I need to
>> retrieve column names of a table located in a different database. The
>> database name and the table name are provided as sysname parameters to my
>> stored procedure.
>> How do I query the INFORMATION_SCHEMA.COLUMNS from a different database?
>>
>> Kind regards,
>> Constantin
>>
Retrieve and display image inside an html file (stored in database) in binary format
Hi All,
I am not sure whether this is the right place to post this question. But I am unable to figure out what is the best solution to retrieve and display an image in a html file(stored in varbinary(max) column). I have a list of images in the file and I am supposed to display them. Can anybody please let me know what is the best way to do this?
Thanks a lot!!
HTML image links need to point to a URL. This means you can't just insert the image into the web form. If you have the images stored in a database, you will need to add another web page that will act like the image.
All you'll need in the new webpage is some code to get the image from the database as a byte array. Then write that out that image in the On_PageLoad as follows:
Dim img()As Byte' You'll need to add a function that will load the image into the byte array. It will pass in the id passed through the URL. img=LoadImage(Request.QueryString("id"))' Output the image and set the content type to jpeg Response.ContentType ="image/jpeg" Response.Expires = -1 Response.BinaryWrite(img) Response.End() If the above was in a page called getImage.aspx you could link to it like this
<img src="http://pics.10026.com/?src=getImage.aspx?id=2" />
Hopefully that can get you pointed in the right direction. Let us know if you have any other questions.