Showing posts with label format. Show all posts
Showing posts with label format. Show all posts

Monday, March 26, 2012

Geting the report url

Hello.

Is there a way in a report to get his url?

I'll explain what i want to do: I want to add an option to export the report to excel format with out useing the menu so i want to add a button (or a table cell) and give him,in the nevigation field, the same url of the rreport with the same parameters but add to him the command "rs:format=excel" and then by pressing the button it will automaticly export my report.

Thanks.I thought it was an easy one :)

If my question is not clear enough, please let me know.

Thanks.|||

Craft a URL like this:

http://localhost/reportserver?/ReportProject1/Report&rs:Command=Render&rs:Format=EXCEL

Documented at http://msdn2.microsoft.com/en-us/library/ms153586.aspx.

Thanks, Donovan

Friday, March 23, 2012

Geting report url inside the report

Hello.
Is there a way in a report to get his url?
I'll explain what i want to do: I want to add an option to export the report to excel format with out useing the menu so i want to add a button (or a table cell) and give him,in the nevigation field, the same url of the rreport with the same parameters but add to him the command "rs:format=excel" and then by pressing the button it will automaticly export my report.
Thanks
From http://www.developmentnow.com/g/115_0_0_0_0_0/sql-server-reporting-services.ht
Posted via DevelopmentNow.com Group
http://www.developmentnow.comi was sure this is an easy one :)
if my question wasn't clear enough, please let me know.
Thanks in advance/

Wednesday, March 21, 2012

getdate() format problem

Hello,
I am just trying to do a simple time stamp. When I do the following SQL
command
SELECT getdate() my book and Microsoft say I should get the format like thi
s:
3/22/2002 6:08:08 AM
Instead when I run this I get the following format:
2006-04-07 18:37:19.823
How do I get it to return the first format?
Thanks,
MichaelGETDATE() returns a datetime datatype, which has no particular display
format, as it is binary in nature. Unless you explicitly convert the
datetime to a character string, SQL Server has nothing to do with how
the date and time are displayed to you. That is a function of the
front end application, such as Query Analyzer (SQL Server 2000) or
Management Studio (SQL Server 2005).
To see what alternatives you have if you convert datetime to a string
explicitly, see the style parameter of the CONVERT function in Books
on Line.
Roy Harvey
Beacon Falls, CT
On Fri, 7 Apr 2006 16:50:02 -0700, Michael
<Michael@.discussions.microsoft.com> wrote:

>Hello,
>I am just trying to do a simple time stamp. When I do the following SQL
>command
>SELECT getdate() my book and Microsoft say I should get the format like th
is:
> 3/22/2002 6:08:08 AM
>Instead when I run this I get the following format:
> 2006-04-07 18:37:19.823
>How do I get it to return the first format?
>Thanks,
>Michael|||Try this:
declare @.date datetime
set @.date = getdate()
select convert(varchar(20), @.date, 101)+ ' ' +convert(varchar(20), @.date, 10
8)
"Roy Harvey" wrote:

> GETDATE() returns a datetime datatype, which has no particular display
> format, as it is binary in nature. Unless you explicitly convert the
> datetime to a character string, SQL Server has nothing to do with how
> the date and time are displayed to you. That is a function of the
> front end application, such as Query Analyzer (SQL Server 2000) or
> Management Studio (SQL Server 2005).
> To see what alternatives you have if you convert datetime to a string
> explicitly, see the style parameter of the CONVERT function in Books
> on Line.
> Roy Harvey
> Beacon Falls, CT
> On Fri, 7 Apr 2006 16:50:02 -0700, Michael
> <Michael@.discussions.microsoft.com> wrote:
>
>|||http://www.aspfaq.com/2464
http://www.aspfaq.com/2460
"Michael" <Michael@.discussions.microsoft.com> wrote in message
news:8669696A-88B3-4F33-88E5-42997C68B387@.microsoft.com...
> Hello,
> I am just trying to do a simple time stamp. When I do the following SQL
> command
> SELECT getdate() my book and Microsoft say I should get the format like
> this:
> 3/22/2002 6:08:08 AM
> Instead when I run this I get the following format:
> 2006-04-07 18:37:19.823
> How do I get it to return the first format?
> Thanks,
> Michael

getdate()

Nothing I do changes the format of the date.
declare @.PubDate datetime
set @.PubDate = convert(varchar,getdate(),111)
SELECT @.PubDate,*
FROM OPENquery(MySQL, 'SELECT * FROM articles WHERE Weight = 3 AND
DateInserted >= DATE_SUB(@.PubDate,INTERVAL 15 DAY) ')
I need it to show the date like yyyy/mm/ddYou can't change the display if it is the variable is declared as a datetime
datatype with convert. Make it a varchar instead.

> declare @.PubDate VARCHAR(24)
> set @.PubDate = convert(varchar(24),getdate(),111)
Andrew J. Kelly SQL MVP
"Curtis" <Curtis@.discussions.microsoft.com> wrote in message
news:A05FC7F0-DADD-4678-B354-E7B2FA8E8A78@.microsoft.com...
> Nothing I do changes the format of the date.
> declare @.PubDate datetime
> set @.PubDate = convert(varchar,getdate(),111)
> SELECT @.PubDate,*
> FROM OPENquery(MySQL, 'SELECT * FROM articles WHERE Weight = 3 AND
> DateInserted >= DATE_SUB(@.PubDate,INTERVAL 15 DAY) ')
> I need it to show the date like yyyy/mm/dd
>|||Thank you. Your answer fixed the formatting issue, but my query doesn't
return any results when it should. It returns results if I hard code the dat
e
in y/m/d format in place of the @.PubDate in my query. I tried
convert(datetime, getdate(), 111), but that, did not solve my problem. Any
other sugestions?
"Andrew J. Kelly" wrote:

> You can't change the display if it is the variable is declared as a dateti
me
> datatype with convert. Make it a varchar instead.
>
> --
> Andrew J. Kelly SQL MVP
>
> "Curtis" <Curtis@.discussions.microsoft.com> wrote in message
> news:A05FC7F0-DADD-4678-B354-E7B2FA8E8A78@.microsoft.com...
>
>|||Well I have no idea what your function DATE_SUB() is doing but you should
have a look at these:
http://www.karaszi.com/SQLServer/info_datetime.asp
Guide to Datetimes
http://www.sqlservercentral.com/col...sqldatetime.asp
Datetimes
http://www.murach.com/books/sqls/article.htm
Datetime Searching
Andrew J. Kelly SQL MVP
"Curtis" <Curtis@.discussions.microsoft.com> wrote in message
news:6930C3C9-2AD7-4259-A7E9-2D4A575C169D@.microsoft.com...
> Thank you. Your answer fixed the formatting issue, but my query doesn't
> return any results when it should. It returns results if I hard code the
> date
> in y/m/d format in place of the @.PubDate in my query. I tried
> convert(datetime, getdate(), 111), but that, did not solve my problem.
> Any
> other sugestions?
> "Andrew J. Kelly" wrote:
>|||Curtis,
I'm surprised this doesn't throw an error, because @.PubDate cannot
be used within the OPENQUERY statement. In addition, since you
have declared @.PubDate as datetime, it does not have a format, and
when used where a string is expected, it will be converted using the
default string format.
You have two options, unless you've hidden some secret about
how @.PubDate is working in the query:
If you are using SQL Server 2005, you can do this:
EXECUTE(
N'SELECT ?, * FROM articles
WHERE Weight = 3 AND DateInserted >= DATE_SUB(?,INTERVAL 15 DAY)',
@.PubDate, @.PubDate) at MySQL
You may or may not have to declare @.PubDate as a string and pre-convert
it--I don't know what your DATE_SUB function expects.
Alternatively, you can create the entire openquery string dynamically:
DECLARE @.sql nvarchar(1000)
DECLARE @.PubDate datetime
SET @.sql = N'SELECT ''?'', * FROM articles
WHERE Weight = 3 AND DateInserted >= DATE_SUB(''?'',INTERVAL 15 DAY)'
SET @.sql = REPLACE(@.sql,'?',CONVERT(varchar,getdate(),111)
EXEC(@.sql)
Be absolutely certain that ? is replaced by something you constructed
yourself from a datetime. Do not let the user provide the substitution
string, or you risk SQL Injection from a maliciously-formed replacement
string.
Steve Kass
Drew University
Curtis wrote:

>Nothing I do changes the format of the date.
>declare @.PubDate datetime
>set @.PubDate = convert(varchar,getdate(),111)
> SELECT @.PubDate,*
>FROM OPENquery(MySQL, 'SELECT * FROM articles WHERE Weight = 3 AND
>DateInserted >= DATE_SUB(@.PubDate,INTERVAL 15 DAY) ')
>I need it to show the date like yyyy/mm/dd
>
>

getdate SQL Convert to Long Format

,convert(varchar,getdate(),101) as [CONFIRMATION_DATE!1!REPORT_DATE]

The above displays as 8/26/2006, anyway you can convert that to a long format in the SP?

I.E. August 26, 2006

Thanks.

i think you are using c sharp code.
i dont know about c sharp. but in vb we do it like this

dim dt as string
dt = Format(Now, "MMMM DD,yyyy")

hope that it might help you.

|||Does thishttp://www.sql-server-helper.com/tips/date-formats.aspx help?|||

Why not simply using this:

select CONVERT(varchar,getdate())

For more information about converting DATETIME to various styles, please refer to the first table in this link:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_ca-co_2f3o.asp

|||

thanks for the replies. The sql helper worked great.

Monday, March 12, 2012

Get the system date format?

Hi!
I'm trying to get hold of the systems date format in my code so that I can change a date I've got. Dates are stored with default format in the database. I'm presenting a date in a messagebox (where it becomes text) and I want to change the format to the system format before I put it in the text. The date must be right with different kind of system settings, swedish, uk...

Can I do that?

I'm using:
to_char(date, 'DD/MM/YYYY')
This works, but of course the format will be uk all the time.

I dont want to write the format, because then i does not mater what my system settings are.

Hope i made my self understandable..Maybee i should have written "get the date format from regional settings".

Sunday, February 26, 2012

Get servers current date format?

sql server 2k...
I found the Set DateFormat method but I can't seem to find a get method
where it will return to me what sqlserver is set as...(mdy,dmy etc..) does
such a method/property exist?
thanks
Doug
Doug Swanson
Senior Applications Developer
Synchrono, Inc
651.228.1772
dswanson@.synchrono.comYou can use DBCC USEROPTIONS.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Doug Swanson" <dcswanson@._remove_this_surfbest.net> wrote in message
news:ujHMya0FEHA.1272@.TK2MSFTNGP12.phx.gbl...
> sql server 2k...
> I found the Set DateFormat method but I can't seem to find a get method
> where it will return to me what sqlserver is set as...(mdy,dmy etc..) doe
s
> such a method/property exist?
> thanks
> Doug
> --
> Doug Swanson
> Senior Applications Developer
> Synchrono, Inc
> 651.228.1772
> dswanson@.synchrono.com
>

get rid of time from SQL servers data by using ASPX

Hi,

I have the problem in accessing data from MS-SQL server by using Dreamwearver MX 's VB.NET page. Although it works well, in the date format, it also display time. Please see the following code.

SELECT student_ID, Material_ID, Borrow_Date, Due_Date, Renew_Date, Status, include_with
FROM dbo.Record
WHERE student_ID = @.student_ID

To remove time, I added the following code as follows. After that, I can preview and works well without having time.


SELECT student_ID, Material_ID, convert(varchar(10),Borrow_Date,103), convert(varchar(10),Due_Date,103), convert(varchar(10),Renew_Date,103), Status, include_with
FROM dbo.Record
WHERE student_ID = @.student_ID

But,Sad when I browse, I get the runtime error. When I look more details in server, the error said " Parser Error Message: The server tag is not well formed." and error in <MM:DataSet"

Please help me.

Jon

Try to use alias for your columns after convertion:

convert(varchar(10),Borrow_Date,103) AS Borrow_Date, convert(varchar(10),Due_Date,103) AS Due_Date,

|||Many thanks indeed.It is working now.Jon|||

don't do the formatting in T-SQL / Database. Do it in the ASP. How are you going to sort it when the date is now :

21/03/2007

01/04/2007