Showing posts with label defined. Show all posts
Showing posts with label defined. Show all posts

Tuesday, March 20, 2012

adding support for user defined functions to the ssis expression language

good idea or bad idea?

Oh yes. A very very very very very very good idea. And if you want an example of why - read this: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=564759&SiteID=1&mode=1

and add a comment to Mahesh's Connect posting here: http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=166356

-Jamie

|||

Jamie Thomson wrote:

Oh yes. A very very very very very very good idea. And if you want an example of why - read this: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=564759&SiteID=1&mode=1

and add a comment to Mahesh's Connect posting here: http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=166356

-Jamie

actually, i got this idea after reading mahesh's thread. so, i went ahead and already created a connect suggestion: https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=166367

Tuesday, March 6, 2012

Adding Multiple Values into a row/column help

Whats the fastest easiest way to take a select that returns say 4 values for the expression into a single column on defined row

basically I mean i want to do an update to say a persons i dunno ummm places they have traveled and I want it listed like france;usa;germany etc etc and the data would always be in the tables i pull from so I can overwrite the data each time i run it but has to take 3 or more values from a query and put them in separated by say a ; into the same persons coloumn that stores the info.

I did this once before with a cursor and adding a variable to itself with colasce or whatever the command was, but was just wondering if there is a fast way to do this by chance that im not thinking about :P.

Thanks!The following example will collect the values from a column in a select statement and create a delimited list from the values.

This will denormalize the values from the source table into a single column so the destination table will not meet the requirements of first normal form. This may be best used for reporting operations, that said:

Two tables are created, one to hold values for the list, and one where the results are inserted.

Test values are inserted into the test table and then a select statement collects the values. (Example supports only 4000 characters)

--Create Test Table
CREATE TABLE dbo.test (
dataField NVARCHAR(10) NOT NULL,
PRIMARY KEY (dataField)
)
GO

--Create Results Table
CREATE TABLE dbo.testResults (
resultId INT IDENTITY (1,1) NOT NULL,
result NVARCHAR(4000) NOT NULL,
PRIMARY KEY (resultId)
)
GO

--Insert Test Data
INSERT dbo.test (dataField) values ('here')
INSERT dbo.test (dataField) values ('there')
INSERT dbo.test (dataField) values ('everywhere')

--Verify Test Data
SELECT dataField FROM dbo.test

--Retrieve colon delimited list of dataField without a cursor
DECLARE @.collectValues NVARCHAR(4000)
SET @.collectValues = ('')

SELECT
@.collectValues = @.collectValues + dataField + ';'
FROM dbo.test

--Verify delimited list
SELECT @.collectValues

--Insert into result table
INSERT dbo.testResults
(result)
VALUES
(@.collectValues)

--Verify inserted data
SELECT resultId, result FROM dbo.testResults

The last select statement should return the result value:
everywhere;here;there;|||Im confused, this doesnt seem like I could get the results correctly from this, You could just use one single select to get all the data like that from that, but what if this works as above, then how would it diferentiate from members and there intrests. Let me give an exampe. Member1 has intrests of fishing,boating,camping, member2 has intrests of fising,hiking,running, how would i basically convert the below

table one

customer intrest

member1 fishing
member1 boating
member1 camping
member2 fishing
member2 hiking
member2 running

go from that data, to this data

table two

customer intrests
member1 fishing;boating;bamping
member2 fising;hiking;running

I dont think the above example can do this can it? Or Am I just missing something? Thanks! hehe|||You are absolutely correct. I misread your intention as wanting the value for a single person (as though you would add this update to a procedure for updating the base table, etc...).

Adding members to User defined role while not dbo.

Hello everyone-
I need to create an account for a user acting as a "mini
DBA". Meaning I would like that user to be able to create
logins and assign users to a truncated role in a user
defined database (say BasicUser). BasicUser can run DML
statements but is NOT allowed to perform any object
management (CREATE/DROP) objects.
Now, I have created an account (say minidba) with
membership in Security Administrator server role. In the
user database, I also gave that login membership in
db_securityadmin database role as well as in BasicUser
(however, I didn't give dbo rights to that user).
From the BooksOnline article, also present in msdn at:
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/tsqlref/ts_sp_addp_4boy.asp
says
"Role owners can execute sp_addrolemember to add a member
to any SQL Server role they own. Members of the
db_securityadmin fixed database role can add users to any
user-defined role."
However, I am able to add new logins with membership in
BasicUser user define role only if I am a member of dbo
NOT with the current setting.
What is the mistake I am making and what can solve this
scenario (or it is not possible)?
Your help is greatly appreciated!
Thanks,
MZeeshanHi MZeeshan,
My name is Michael and I would like to thank you for using Microsoft
newsgroup.
As I understand, you have a user-defined role called BasicUser and a login
called minidba with membership in db_securityadmin fixed database role on a
specified database, Security Administrator fixed server role and BasicUser
user define role. The problem is you are unable to perform sp_addrolemember
to add a new user to the BasicUser user define role using the minidba
login on the specified database. If I have misunderstood, please feel free
to let me know.
Firstly, I would like you to understand that user is different with login.
The login is specified on server and the user is specified on database.
Login identifiers (IDs) are associated with users when they connect to an
instance of Microsoft? SQL Server? 2000. Login IDs are the accounts that
control access to the instance of SQL Server. A user cannot connect to an
instance without first specifying a valid login ID.
For more information regarding logins and users, please refer to the
articles on SQL Server Books Online.
Topic: "Users"
Topic: "Logins"
On my side, I can use sp_addrolemember to add a new user to the BasicUser
user define role. There is not any error. The security setting is the same
as the ones I mentioned above.
For more information regarding sp_addrolemember, please refer to the
following article on SQL Server Books Online.
Topic: "sp_addrolemember"
Do you mean that you still cannot add a new user (NOT Login) to the user
define role on the specified database? If so, please try to perform the
sp_addrolemember to add the new user with the same security setting using
Query Analyzer and provide the detailed error message.
I am standing by for your response.
Regards,
Michael Shao
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.|||My settings for the login "miniDba" (in reality we are using Windows Authent
ication).
Assigned roles::
Server Role: Security Administrator
Database role: [user defined] BasicUser, db_securityadmin
Purpose:
The database account identified by "minidba" wants to have authority to crea
te logins and assign them rights to the user database accessed through 'Basi
cUser' role. This role has DML rights on the tables.
As a dba I do not want to give 'dbo' rights on that user database to 'minidb
a'. Referring to the article quoted in last posting, 'minidba' can create an
other login with rights to 'basicuser' as long as he/she owns 'basicuser' (I
was not sure about db_secu
rityadmin so I gave that as an extra step).
Now, I was using EM. So, unless I grant 'minidba' dbo on the database, that
login is unable to assign any database rights (including those on BasicUser
role). However, that account is able to create server logins without any pro
blem.
So, are you saying the only way is to use the stored precedure. Because this
will create a chicken and egg story as I was not interested in giving that
person dbo rights in first place because she doesn't have that much DBA skil
ls.
Please clarify that login 'minidba' should be able to assign database rights
of 'BasicUser' on a newly created login as long as it is member of that gro
up? what about membership of 'minidba' in db_securityadmin fixed database ro
le.
Thanks,
Muhammad|||Hi Muhammad,
Thanks for your update. I understand the situation on your side below:
Login 'miniDba'
Server Role: Security Administrator
Database role: [user defined] BasicUser, db_securityadmin
You want to use this using this login connecting to the SQL Server. The
following actions are what you want to do.
1. Create the new logins.
2. On the Database Access tab in the SQL Server login property dialog, you
want to check the permit of the user defined database role on the specified
user database, when you create the login.
3. The BOL said "Role owners can execute sp_addrolemember to add a member
to any SQL Server role they own. Members of the db_securityadmin fixed
database role can add users to any user-defined role."
Result:
You puzzled with these statements, because you failed with the second
actions.
If I have misunderstood, please feel free to let me know.
Based on my research, when you performed the second action, the EM does two
things. First, he adds the new user to the specified database and then
assigns the membership of the user defined database.
Therefore, the statements in the BOL are correct that members of the
db_securityadmin fixed database role can add users to any user-defined
role." The miniDba login is the member of the db_securityadmin so that he
can assigns the membership of the user defined database role. However, he
cannot add a new user to the specified database.
You can try to add the membership of the db_accessadmin so that you can add
or remove user IDs on the specified database. Then the second action will
be successful.
As the other fixed database roles, because the miniDba is only the
membership of the db_securityadmin and db_accessadmin, failing to assign
the other membership of the other database roles to the specified users are
normal.
I hope the explanation is clear. Please let us know if you need further
assistance on this issue.
Regards,
Michael Shao
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Friday, February 24, 2012

adding fields in page footer

Hi Every one
I have problem in using page footer field from the storeprocedure. I have a procedure and defined two fields one is page header and page footer. When I drag and drop them repective area it displaying error message you can't use fields for header and footer than how can I use them please help me. I am new to this reporting services.Please, I got this issue too.
Does anyone get good solution?
thanks.|||I don't know if I understand you correctly but....if you are using visual studio.net
you can only use globals! and textboxes with text in them.

I hope this is what you are looking for. I am pretty new at this also.

Hope you find an answer to your problem,
Kerrie|||Can you put them in the table header & table footer?|||

Hi,
For some reason VS.net is very limited on what you can do in the headers and footers. No fields or tools can go in them. VS.net will only accept globals and textboxes with text.

I have not tried any constants-i dont know about that one.

I hoped that helped.

thanx and have a great day...

Kerrie

|||You can use fields in the page header and footer by using a hidden parameter. You select the fields in your stored procedure or SQL just like normal fields and then set up a hidden parameter, referencing the field. In the SSRS 2000 version, leave the Prompt value blank – this makes it hidden. In SSRS 2005, set the Hidden check box on the Report Parameters dialog box.

Next, add a new parameter to your report and set the “default value” by selecting the field from your dataset.
Then, create a text box whose value will be the new parameter - i.e. “=Parameters!Footer.Value”

Adding Externall DLL functions written in Visual C++

Hi,

I'm trying to add exernal functions defined by a third party in a dll. They developed the dll in Visual C++ and is provided as is, with very little additional info about the code. The dll is tested and can be integrated into an application developed with VB.NET but no other experiences are available. I tried to add the functions to SQL Server 2005 Express edition but on attempting to CREATE the ASSEMBLY i get the following error:

CREATE ASSEMBLY for assembly 'ThirdPartyDll' failed because assembly 'ThirdPartyDll' is malformed or not a pure .NET assembly.

Unverifiable PE Header/native stub.

No rows affected.

(0 row(s) returned)

@.RETURN_VALUE = -6

Finished running [dbo].[ThirdPartyDll].

Is there an alternative way to add these functions for non pure .NET assemblies, or in general, is there a workaround to solve the problem?

By the way, do i need to register the dll with RegSvr32 first?

Thanks,

Marco.

Your third party dll is probably a COM dll.

You will have to use interop to create a .Net wrapper for the com dll. Both the dll's will have to be installed on your server (yes - you'll have to regsvr32 the original dll). When creating the assembly on the database you'll have to specify unsafe so that you may access external code.

It is not very recommended that you call C++ COM dll's from sql's clr...

Thursday, February 9, 2012

adding amharic to SQL

I'm trying to build a database which will support amharic,
It is not defined in the SQL server collations,
How can I add amharic to be supported by the server ?
Amaharic is part of unicode 4.
If I add amharic to windows does it enough ?
Thanks,
Eyal
eyalbengal@.gmail.com
eyalbengal@.gmail.com (eyalbengal@.gmail.com@.discussions.microsoft.com)
writes:
> I'm trying to build a database which will support amharic,
> It is not defined in the SQL server collations,
> How can I add amharic to be supported by the server ?
> Amaharic is part of unicode 4.
> If I add amharic to windows does it enough ?
Unfortunately, I don't think you have much luck here. You cannot add
collations to SQL Server.
You can of course store data in Amharic in nvarchar columns, but without
a good collation you cannot ger proper sorting, proper rules for comparing
etc. The best choice is probably a binary collation, for instance
Latin1_General_BIN, but it's a poor substitution.
I also looked of what is available in SQL 2005, but I can't see Ahmaric
or any related language there.
I would suggest that you drop a mail to sqlwish@.microsoft.com so they
know that there is a need for Amharic and related languages out there.
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp

adding amharic to SQL

I'm trying to build a database which will support amharic,
It is not defined in the SQL server collations,
How can I add amharic to be supported by the server ?
Amaharic is part of unicode 4.
If I add amharic to windows does it enough ?
Thanks,
Eyal
eyalbengal@.gmail.comeyalbengal@.gmail.com (eyalbengal@.gmail.com@.discussions.microsoft.com)
writes:
> I'm trying to build a database which will support amharic,
> It is not defined in the SQL server collations,
> How can I add amharic to be supported by the server ?
> Amaharic is part of unicode 4.
> If I add amharic to windows does it enough ?
Unfortunately, I don't think you have much luck here. You cannot add
collations to SQL Server.
You can of course store data in Amharic in nvarchar columns, but without
a good collation you cannot ger proper sorting, proper rules for comparing
etc. The best choice is probably a binary collation, for instance
Latin1_General_BIN, but it's a poor substitution.
I also looked of what is available in SQL 2005, but I can't see Ahmaric
or any related language there.
I would suggest that you drop a mail to sqlwish@.microsoft.com so they
know that there is a need for Amharic and related languages out there.
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp|||Hi,
Did you manage to solve the problem?
I am having the same problem, i cant get my database to sort properly.
Frans
"Erland Sommarskog" wrote:
> eyalbengal@.gmail.com (eyalbengal@.gmail.com@.discussions.microsoft.com)
> writes:
> > I'm trying to build a database which will support amharic,
> > It is not defined in the SQL server collations,
> >
> > How can I add amharic to be supported by the server ?
> > Amaharic is part of unicode 4.
> > If I add amharic to windows does it enough ?
> Unfortunately, I don't think you have much luck here. You cannot add
> collations to SQL Server.
> You can of course store data in Amharic in nvarchar columns, but without
> a good collation you cannot ger proper sorting, proper rules for comparing
> etc. The best choice is probably a binary collation, for instance
> Latin1_General_BIN, but it's a poor substitution.
> I also looked of what is available in SQL 2005, but I can't see Ahmaric
> or any related language there.
> I would suggest that you drop a mail to sqlwish@.microsoft.com so they
> know that there is a need for Amharic and related languages out there.
>
> --
> --
> Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp
>

adding amharic to SQL

I'm trying to build a database which will support amharic,
It is not defined in the SQL server collations,
How can I add amharic to be supported by the server ?
Amaharic is part of unicode 4.
If I add amharic to windows does it enough ?
Thanks,
Eyal
eyalbengal@.gmail.comeyalbengal@.gmail.com (eyalbengal@.gmail.com@.discussions.microsoft.com)
writes:
> I'm trying to build a database which will support amharic,
> It is not defined in the SQL server collations,
> How can I add amharic to be supported by the server ?
> Amaharic is part of unicode 4.
> If I add amharic to windows does it enough ?
Unfortunately, I don't think you have much luck here. You cannot add
collations to SQL Server.
You can of course store data in Amharic in nvarchar columns, but without
a good collation you cannot ger proper sorting, proper rules for comparing
etc. The best choice is probably a binary collation, for instance
Latin1_General_BIN, but it's a poor substitution.
I also looked of what is available in SQL 2005, but I can't see Ahmaric
or any related language there.
I would suggest that you drop a mail to sqlwish@.microsoft.com so they
know that there is a need for Amharic and related languages out there.
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Hi,
Did you manage to solve the problem?
I am having the same problem, i cant get my database to sort properly.
Frans
"Erland Sommarskog" wrote:

> eyalbengal@.gmail.com (eyalbengal@.gmail.com@.discussions.microsoft.com)
> writes:
> Unfortunately, I don't think you have much luck here. You cannot add
> collations to SQL Server.
> You can of course store data in Amharic in nvarchar columns, but without
> a good collation you cannot ger proper sorting, proper rules for comparing
> etc. The best choice is probably a binary collation, for instance
> Latin1_General_BIN, but it's a poor substitution.
> I also looked of what is available in SQL 2005, but I can't see Ahmaric
> or any related language there.
> I would suggest that you drop a mail to sqlwish@.microsoft.com so they
> know that there is a need for Amharic and related languages out there.
>
> --
> --
> Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techin.../2000/books.asp
>