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

Friday, March 30, 2012

Hide only export dropdown list and "Export" link button from report toolbar in sql rep

Hi All

I want to hide export dropdown list and "Export" link button from reportviewer toolbar . because i create my own export function so ,

Please help me in this

Thanks

Alpesh

I think that this url can be helpuff:

http://blogs.msdn.com/bimusings/archive/2005/07/08/436887.aspx

Hide only export dropdown list and "Export" link button from report toolbar in sql

Hi All

I want to hide export dropdown list and "Export" link button from reportviewer toolbar . because i create my own export function so ,

Please help me in this

Thanks

Alpesh

I think that this url can be helpuff:

http://blogs.msdn.com/bimusings/archive/2005/07/08/436887.aspx

sql

Monday, March 12, 2012

Hex

Is there not a function in MS/SQL to return the hex representation of a character?
HEX("A") = 41 for example.[un-sniped]
SELECT ASCII('A')
SELECT CHAR(65)
[/un-sniped]

I swear your post beat me in, now it's the other way around...

ORDER BY PostDate|||select cast(ascii('A') as varbinary)

To flip to integer:

select cast(0x0000002C as int)

To convert back to character:

select char(cast(ascii('A') as varbinary))|||Thanks so much!

heterogeneous Function

Hello Everyone,
I have a procedure which returns profits made by sales persons.
for this I need to access 2 data bases.
to calculate the profit I have written a function on one of the databases
but I get an error asking me to set ANSI_NULLS and ANSI_WARNINGS. when I set
these I get syntax error.
Am I missing to do something here.
Any help is greatly appreciated.
Rose.Without a repro, here is a guess: Make sure you have the settings while
creating the function.
SET ANSI_NULLS ON
SET ANSI_WARNINGS ON
GO
CREATE FUNCTION ufn_test(...
...
GO
Anith

Monday, February 27, 2012

Help: SELECT from a string

I'm really new to T-SQL, so this is probably a really easy question, but here goes:

I'm trying to create a function that selects builds a string specifying a table to select from:

SELECT * FROM ('AdventureWorks.sys.schemas')

That's what I want to do, but it gives me:

Incorrect syntax near 'AdventureWorks.sys.schemas'.

Basically, I need to know how to convert from a string to a table type. Hopefully this is easy.

Thanks a bunch!

In order to do that you will need dynamic sql, but because you mentioned that you are new, I will recomend to stay away from it by now and move forward in learning T-SQL.

The Curse and Blessings of Dynamic SQL

http://www.sommarskog.se/dynamic_sql.html

AMB

|||

You can't 'convert' from a string to a table type. As Alejandro indicates, using dynamic SQL may be the only viable option.

As you will discover upon reviewing Erland's article (see link above), using dynamic SQL has quite a few security issues, and if used improperly, may jepardize the safety and security of your server and data.

Sunday, February 19, 2012

Help: about charindex function doesnt work with variable

Hello to all,

I hope that somebody can help me.

I have written a sql query to search Partner. I have a wtcomValidRelationships Table. There are two Fields(IDMember(type: Int) andRelationshipIDs(type: varchar(1000))in this table.

Example: 3418 has 3422 RelationshipID and 3422 has 4088 RelationshipID, if i want to check if there is a relationship between 3418 and 4088.

declare @.IDMint;

declare @.IDOchar(100);

set @.IDM= 3418;

set @.IDO='4088';

select B.IDMember

from wtcomValidRelationshipsas A, wtcomValidRelationshipsas B

where A.IDMember= @.IDMandcharindex(cast(B.IDMemberaschar(100)),A.RelationshipIDS)> 0

andcharindex(@.IDO,B.RelationshipIDs)> 0

Using this query i get nothing.

I try to use constant incharindex and i get result.

declare @.IDMint;

declare @.IDOchar(100);

set @.IDM= 3418;

set @.IDO='4088';

select B.IDMember

from wtcomValidRelationshipsas A, wtcomValidRelationshipsas B

where A.IDMember= @.IDMandcharindex('3422',A.RelationshipIDS)> 0

andcharindex('4088',B.RelationshipIDs)> 0

So i think that charindex doesn't work with variable. But I must use variable. Can someone help me? What should i do ?

Thanks

Best Regards

Pinsha

Hi Shasha,

See the earlier post and question you have asked about the same issue and use the PATINDEX i have updated the code. Just see the earlier question reply.

help: indexed view question

I have created a unique clustered index on a view.
The view does a GROUP BY on 3 of the columns and
uses the COUNT_BIG aggregate function.
I used the following SET commands before creating the view and the index:

SET ARITHABORT ON
SET CONCAT_NULL_YIELDS_NULL ON
SET QUOTED_IDENTIFIER ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
SET NUMERIC_ROUNDABORT OFF

I can insert and delete rows from the base table, and the indexed view is updated fine.

However, when a scheduled job does effectively the same thing (delete some rows, and insert some new rows) I get the following error:

Executed as user: NT AUTHORITY\SYSTEM. DELETE failed because the following SET options have incorrect settings: 'ARITHABORT'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or query notifications and/or xml data type methods. [SQLSTATE 42000] (Error 1934). The step failed.

Why am I getting this error?

The same SET commands above are in the Transact-SQL code for the job before the delete and before the insert statements.

Thanks,
TomYES!!!!! I found a simple solution!!!

I simply put a GO after the SETs.
Although the code was not exactly in a stored procedure I suppose it acted like it was (the code was in a T-SQL script as one of the steps of a SQL Server agent job in Management Studio).
It may not sound like much, but this will help save 1 hour a month for an end user ... for probably 3-4 years!

Thanks Dan Guzman (SQL Server MVP) and Alex Kuznetsov!!!
:beer: