Showing posts with label bit. Show all posts
Showing posts with label bit. Show all posts

Thursday, March 8, 2012

Dead easy string handling question

Hi there,

I'm a bit embarrassed about this question, because I'm sure that a lot of you would find it trivial, but I'm really not the best at T-SQL and especially not string handling.

I'm trying to generate a 'parent' value, by replacing characters in the 'child' field with ''. It's a classic Chart of Accounts sort of problem, for feeding into a Parent/Child dimension in AS. It's a lot easier to understand if you look at this:

This is the set I have:

GLCode GLDescription
0.-.-.- Balance S
0.0.-.- Balance S.Balance Sheet
0.0.0.- Balance S.Balance Sheet.Balance Sheet
0.0.0.5000 Balance S.Balance Sheet.Balance Sheet.Assets - Area1

0.0.0.5001 Balance S.Balance Sheet.Balance Sheet.Assets - Area2
0.0.0.5002 Balance S.Balance Sheet.Balance Sheet.Assets - Area3

This is the set I want

Ch GLCode Par GLCode GLDescription
0.-.-.- -.-.-.- Balance S
0.0.-.- 0.-.-.- Balance S.Balance Sheet
0.0.0.- 0.0.-.- Balance S.Balance Sheet.Balance Sheet
0.0.0.5000 0.0.0.- Balance S.Balance Sheet.Balance Sheet.Assets - Area1

0.0.0.5001 0.0.0.- Balance S.Balance Sheet.Balance Sheet.Assets - Area2
0.0.0.5002 0.0.0.- Balance S.Balance Sheet.Balance Sheet.Assets - Area3

That is to say,

0.0.0.- is the parent of 0.0.0.5001

0.0.-.- is the parent of 0.0.0.-

0.-.-.- is the parent of 0.0.-.-

So, what I really need to do is replace the last non '-' string with '-'. I've tried various combos of PATINDEX, CHARINDEX, REPLACE etc, but I'm really struggling. To make in more complicated, and of the strings between the . can be any length.

Any ideas?

Maybe something like this would work for you:

SET NOCOUNT ON

DECLARE @.MyTable table
( RowID int IDENTITY,
GLCode varchar(20),
[Description] varchar(100)
)

INSERT INTO @.MyTable VALUES ( '0.-.-.-', 'Balance S' )
INSERT INTO @.MyTable VALUES ( '0.0.-.-', 'Balance S.Balance Sheet' )
INSERT INTO @.MyTable VALUES ( '0.0.0.-', 'Balance S.Balance Sheet.Balance Sheet' )
INSERT INTO @.MyTable VALUES ( '0.0.0.5000', 'Balance S.Balance Sheet.Balance Sheet.Assets - Area1' )
INSERT INTO @.MyTable VALUES ( '0.0.0.5001', 'Balance S.Balance Sheet.Balance Sheet.Assets - Area2' )
INSERT INTO @.MyTable VALUES ( '0.0.0.5002', 'Balance S.Balance Sheet.Balance Sheet.Assets - Area3' )

SELECT
[Ch GLCode] = GLCode,
[Par GLCode] = CASE
WHEN isnumeric( parsename( GLCode, 1 )) = 1 THEN '0.0.0.-'
WHEN parsename( GLCode, 2 ) <> '-' THEN '0.0.-.-'
WHEN parsename( GLCode, 3 ) <> '-' THEN '0.-.-.-'
WHEN parsename( GLCode, 4 ) <> '-' THEN '-.-.-.-'
END,
[Description]
FROM @.MyTable
ORDER BY GLCode

Ch GLCode Par GLCode Description
-- - -

0.-.-.- -.-.-.- Balance S
0.0.-.- 0.-.-.- Balance S.Balance Sheet
0.0.0.- 0.0.-.- Balance S.Balance Sheet.Balance Sheet
0.0.0.5000 0.0.0.- Balance S.Balance Sheet.Balance Sheet.Assets - Area1
0.0.0.5001 0.0.0.- Balance S.Balance Sheet.Balance Sheet.Assets - Area2
0.0.0.5002 0.0.0.- Balance S.Balance Sheet.Balance Sheet.Assets - Area3

|||

Thanks for that Arnie,

I did something a bit stupid in my example - I implied that the source dataset is a lot simpler than it acually is. It's a 13,000 row Chart of Accounts, and I just gave you the top 6 rows. If we look further down, and resample the data, we can see members like this:

3.R.W.4501 3.S.-.- 3.S.A.- 3.S.A.0001 3.S.A.0003 3.S.A.0005 3.S.A.0102 3.S.A.0110

In this case, 3.S.A.0001 , 3.S.A.0003 , 3.S.A.0005 , 3.S.A.0102 , 3.S.A.0110 are the children of parent 3.S.A.-

3.S.A.- is the child of parent 3.S.-.-

3.S.-.- is the child of parent 3.-.-.-

(and we can therefore infer that the top member, 3.R.W.4501 is the child of 3.R.W.-

so I don't think your approach of hardcoding the parent into the CASE would work. But your approach was perfectly reasonable, given the lame example you had to work with!

You used ISNUMERIC, which I didn't think of, and PARSENAME, which I haven't used before, so I'll see if I can use those in a more dynamic solution.

As you've probably guessed, I'm a long way from being a T-SQL ninja, so if anyone has any clever ideas on how I should approach this, I'd be interested to know...

|||

The approach I supplied previously seems to work just fine on the additional values you supplied.

(And should as long as the forth part is always a number.)

|||

Maybe I'm missing something, but I don't quite understand how hardcoding '0's into the output is going to help where the code is something like '2.H.A.003'. But you've given me some ideas, so thanks for your help.

SELECT
[Ch GLCode] = GLCode,
[Par GLCode] = CASE
WHEN isnumeric( parsename( GLCode, 1 )) = 1 THEN '0.0.0.-'
WHEN parsename( GLCode, 2 ) <> '-' THEN '0.0.-.-'
WHEN parsename( GLCode, 3 ) <> '-' THEN '0.-.-.-'
WHEN parsename( GLCode, 4 ) <> '-' THEN '-.-.-.-'
END,
[GLDescription]
FROM dbo.WRK_CoA
ORDER BY GLCode

Ch GLCode Par GLCode GLDescription
1.S.U.0380 0.0.0.- Academy of F&H Education.Planning
1.S.U.0600 0.0.0.- Academy of F&H Education.Planning and Develop
2.-.-.- -.-.-.- Adult Academy
2.B.-.- 0.-.-.- Adult Academy.Creative & Cultural Industries
2.B.S.- 0.0.-.- Adult Academy.Creative & Cultural Industri
2.B.S.0130 0.0.0.- Adult Academy.Creative & Cultural Indus
2.H.-.- 0.-.-.- Adult Academy.Employment Services
2.H.A.- 0.0.-.- Adult Academy.Employment Services.Bu
2.H.A.0001 0.0.0.- Adult Academy.Employment Services.Busin
2.H.A.0003 0.0.0.- Adult Academy.Employment Services.Busines
2.H.A.0005 0.0.0.- Adult Academy.Employment Services.Busine
2.H.A.0102 0.0.0.- Adult Academy.Employment Services.Business
2.H.A.0110 0.0.0.- Adult Academy.Employment Services.Business

|||

Sam,

Sorry, I should have gone into more detail. You can use PARSENAME() to deconstruct the values, AND you can use

PARSENAME() to re-construct the values.

Hopefully this will give you the guidance you need.


DECLARE @.MyTable table
( RowID int IDENTITY,
GLCode varchar(20)

)

INSERT INTO @.MyTable VALUES ( '0.-.-.-' )
INSERT INTO @.MyTable VALUES ( '0.0.-.-' )
INSERT INTO @.MyTable VALUES ( '0.0.0.-' )
INSERT INTO @.MyTable VALUES ( '0.0.0.5000' )
INSERT INTO @.MyTable VALUES ( '0.0.0.5001' )
INSERT INTO @.MyTable VALUES ( '0.0.0.5002' )
INSERT INTO @.MyTable VALUES ( '3.R.W.4501' )
INSERT INTO @.MyTable VALUES ( '3.S.-.-' )
INSERT INTO @.MyTable VALUES ( '3.S.A.-' )
INSERT INTO @.MyTable VALUES ( '3.S.A.0001' )
INSERT INTO @.MyTable VALUES ( '3.S.A.0003' )
INSERT INTO @.MyTable VALUES ( '3.S.A.0005' )
INSERT INTO @.MyTable VALUES ( '3.S.A.0102' )
INSERT INTO @.MyTable VALUES ( '3.S.A.0110' )


SELECT
[Ch GLCode] = GLCode,
[Par GLCode] = CASE
WHEN isnumeric( parsename( GLCode, 1 )) = 1
THEN parsename( GLCode, 4 ) + '.' + parsename( GLCode, 3 ) + '.' + parsename( GLCode, 2 ) + '.-'
WHEN parsename( GLCode, 2 ) <> '-'
THEN parsename( GLCode, 4 ) + '.' + parsename( GLCode, 3 ) + '.-.-'
WHEN parsename( GLCode, 3 ) <> '-'
THEN parsename( GLCode, 4 ) + '.-.-.-'
WHEN parsename( GLCode, 4 ) <> '-' THEN '-.-.-.-'
END

FROM @.MyTable
ORDER BY GLCode

Ch GLCode Par GLCode

-- -
0.-.-.- -.-.-.-
0.0.-.- 0.-.-.-
0.0.0.- 0.0.-.-
0.0.0.5000 0.0.0.-
0.0.0.5001 0.0.0.-
0.0.0.5002 0.0.0.-
3.R.W.4501 3.R.W.-
3.S.-.- 3.-.-.-
3.S.A.- 3.S.-.-
3.S.A.0001 3.S.A.-
3.S.A.0003 3.S.A.-
3.S.A.0005 3.S.A.-
3.S.A.0102 3.S.A.-
3.S.A.0110 3.S.A.-

|||

i dunno, here's my attempt:

Code Snippet

SET NOCOUNT ON

DECLARE @.MyTable table

( RowID int IDENTITY,

GLCode varchar(20),

[Description] varchar(100)

)

INSERT INTO @.MyTable VALUES ( '3.-.-.-', 'Balance S' )

INSERT INTO @.MyTable VALUES ( '3.S.-.-', 'Balance S.Balance Sheet' )

INSERT INTO @.MyTable VALUES ( '3.S.A.-', 'Balance S.Balance Sheet.Balance Sheet' )

INSERT INTO @.MyTable VALUES ( '3.S.A.0001', 'Balance S.Balance Sheet.Balance Sheet.Assets - Area1' )

INSERT INTO @.MyTable VALUES ( '3.S.A.5001', 'Balance S.Balance Sheet.Balance Sheet.Assets - Area2' )

INSERT INTO @.MyTable VALUES ( '3.S.A.5002', 'Balance S.Balance Sheet.Balance Sheet.Assets - Area3' )

SELECT

CASE

WHEN CHARINDEX('-', GLCode) = 0 THEN LTRIM(RTRIM(LEFT(GLCode, LEN(GLCode) - CHARINDEX('.', REVERSE(GLCode)))))

WHEN CHARINDEX('-', GLCODE) = 3 THEN '-.-.-.-'

ELSE LTRIM(RTRIM(LEFT(GLCode, CHARINDEX('.-', GLCode))))

END

FROM @.MyTable

edit: the above isn't correct, but perhaps it'll offer some help...|||

Thanks guys - I can see that I'll be able to pick apart what you've done and come up with a solution.

Saturday, February 25, 2012

DCOM Error 10005

I have a setup where in following scenario i get DCOM error
1. Install a 32 bit NT service on x64
2. Install SQL 2005 Server
3. Upgrade the 32bit NT service using msi package.
After step 2 the NT service is running fine.
But after step 3,
Service fails to start with Error,
The MyService service failed to start due to the following error:
The service did not respond to the start or control request in a
timely fashion. (event 7000)
Event viewer also shows the DCOM error 10005.
DCOM got error "The service did not respond to the start or control
request in a timely fashion. " attempting to start the service
MyService with arguments "-Service" in order to run the server.
This problem is seen only on setups where i have SQL 2005 installed.
Is there a way to find out why "Service Control Manager" manager gives
errors 7000 & 7009. '
MyService is created using VC6 ATL wizard. It is run in "Local System"
account and in non-interactive mode.
Any help will be greatly appreciated.
Thanks,
wnHi
"wn123456@.gmail.com" wrote:
> I have a setup where in following scenario i get DCOM error
> 1. Install a 32 bit NT service on x64
> 2. Install SQL 2005 Server
> 3. Upgrade the 32bit NT service using msi package.
> After step 2 the NT service is running fine.
> But after step 3,
> Service fails to start with Error,
> The MyService service failed to start due to the following error:
> The service did not respond to the start or control request in a
> timely fashion. (event 7000)
> Event viewer also shows the DCOM error 10005.
> DCOM got error "The service did not respond to the start or control
> request in a timely fashion. " attempting to start the service
> MyService with arguments "-Service" in order to run the server.
> This problem is seen only on setups where i have SQL 2005 installed.
> Is there a way to find out why "Service Control Manager" manager gives
> errors 7000 & 7009. '
> MyService is created using VC6 ATL wizard. It is run in "Local System"
> account and in non-interactive mode.
> Any help will be greatly appreciated.
> Thanks,
> wn
>
You may want to check http://support.microsoft.com/kb/892500 this shows how
to turn on logging so you may get more information.
John|||On Feb 27, 7:23 pm, John Bell <jbellnewspo...@.hotmail.com> wrote:
> Hi
>
>
> "wn123...@.gmail.com" wrote:
> > I have a setup where in following scenario i get DCOM error
> > 1. Install a 32 bit NT service on x64
> > 2. Install SQL 2005 Server
> > 3. Upgrade the 32bit NT service using msi package.
> > After step 2 the NT service is running fine.
> > But after step 3,
> > Service fails to start with Error,
> > The MyService service failed to start due to the following error:
> > The service did not respond to the start or control request in a
> > timely fashion. (event 7000)
> > Event viewer also shows the DCOM error 10005.
> > DCOM got error "The service did not respond to the start or control
> > request in a timely fashion. " attempting to start the service
> > MyService with arguments "-Service" in order to run the server.
> > This problem is seen only on setups where i have SQL 2005 installed.
> > Is there a way to find out why "Service Control Manager" manager gives
> > errors 7000 & 7009. '
> > MyService is created using VC6 ATL wizard. It is run in "Local System"
> > account and in non-interactive mode.
> > Any help will be greatly appreciated.
> > Thanks,
> > wn
> You may want to checkhttp://support.microsoft.com/kb/892500this shows how
> to turn on logging so you may get more information.
> John- Hide quoted text -
> - Show quoted text -
Thanks John.
I tried by adding registry entries mentioned in the KB article. But i
am not getting any additional error events.
Looks like this is not an DCOM related problem.
I have another NT service which is not a COM service that too shows
the same problem.
Do you have any idea if i can enable some logging for "Service control
Manager" ?
The control do not reach to ServiceMain function of MyService.
Is it that "Service control Manager" is returning error ?|||Hi
> Thanks John.
> I tried by adding registry entries mentioned in the KB article. But i
> am not getting any additional error events.
> Looks like this is not an DCOM related problem.
> I have another NT service which is not a COM service that too shows
> the same problem.
> Do you have any idea if i can enable some logging for "Service control
> Manager" ?
> The control do not reach to ServiceMain function of MyService.
> Is it that "Service control Manager" is returning error ?
>
Have you looked in the event log for any messages?
John

DCOM Error 10005

I have a setup where in following scenario i get DCOM error
1. Install a 32 bit NT service on x64
2. Install SQL 2005 Server
3. Upgrade the 32bit NT service using msi package.
After step 2 the NT service is running fine.
But after step 3,
Service fails to start with Error,
The MyService service failed to start due to the following error:
The service did not respond to the start or control request in a
timely fashion. (event 7000)
Event viewer also shows the DCOM error 10005.
DCOM got error "The service did not respond to the start or control
request in a timely fashion. " attempting to start the service
MyService with arguments "-Service" in order to run the server.
This problem is seen only on setups where i have SQL 2005 installed.
Is there a way to find out why "Service Control Manager" manager gives
errors 7000 & 7009. '
MyService is created using VC6 ATL wizard. It is run in "Local System"
account and in non-interactive mode.
Any help will be greatly appreciated.
Thanks,
wnHi
"wn123456@.gmail.com" wrote:

> I have a setup where in following scenario i get DCOM error
> 1. Install a 32 bit NT service on x64
> 2. Install SQL 2005 Server
> 3. Upgrade the 32bit NT service using msi package.
> After step 2 the NT service is running fine.
> But after step 3,
> Service fails to start with Error,
> The MyService service failed to start due to the following error:
> The service did not respond to the start or control request in a
> timely fashion. (event 7000)
> Event viewer also shows the DCOM error 10005.
> DCOM got error "The service did not respond to the start or control
> request in a timely fashion. " attempting to start the service
> MyService with arguments "-Service" in order to run the server.
> This problem is seen only on setups where i have SQL 2005 installed.
> Is there a way to find out why "Service Control Manager" manager gives
> errors 7000 & 7009. '
> MyService is created using VC6 ATL wizard. It is run in "Local System"
> account and in non-interactive mode.
> Any help will be greatly appreciated.
> Thanks,
> wn
>
You may want to check http://support.microsoft.com/kb/892500 this shows how
to turn on logging so you may get more information.
John|||On Feb 27, 7:23 pm, John Bell <jbellnewspo...@.hotmail.com> wrote:
> Hi
>
>
> "wn123...@.gmail.com" wrote:
>
>
>
>
>
>
>
> You may want to checkhttp://support.microsoft.com/kb/892500this shows how
> to turn on logging so you may get more information.
> John- Hide quoted text -
> - Show quoted text -
Thanks John.
I tried by adding registry entries mentioned in the KB article. But i
am not getting any additional error events.
Looks like this is not an DCOM related problem.
I have another NT service which is not a COM service that too shows
the same problem.
Do you have any idea if i can enable some logging for "Service control
Manager" ?
The control do not reach to ServiceMain function of MyService.
Is it that "Service control Manager" is returning error ?|||Hi

> Thanks John.
> I tried by adding registry entries mentioned in the KB article. But i
> am not getting any additional error events.
> Looks like this is not an DCOM related problem.
> I have another NT service which is not a COM service that too shows
> the same problem.
> Do you have any idea if i can enable some logging for "Service control
> Manager" ?
> The control do not reach to ServiceMain function of MyService.
> Is it that "Service control Manager" is returning error ?
>
Have you looked in the event log for any messages?
John

Sunday, February 19, 2012

dbo owner

Hi Everyone,
I'm still with this problem and now I have little bit of time to find the
solution.
After any user import data to a table I want to have that table as dbo
owner.
I dont want to give my users full administrator permisssions.
I try to setup in each database access as db_owner, db_accesmin,
db_dlladmin but no luck
I know I can change the owner later with sp_changeobjectowner but sometimes
I run crazy with more than three users at the same time.
How can I fix this issue?
Tks
JFBCould you be more specific?
Do you use qualified object names? (two-part names: owner.object_name)
ML|||Yeah, a sample table, user, and a query you are trying to run in a script
would really make this easier.
Otherwise the best answer (as usual) is 42. Sadly we still don't know the
question to that answer either :)
----
Louis Davidson - http://spaces.msn.com/members/drsql/
SQL Server MVP
"ML" <ML@.discussions.microsoft.com> wrote in message
news:77548CF2-DE05-4C93-A509-4BDF04EF49C8@.microsoft.com...
> Could you be more specific?
> Do you use qualified object names? (two-part names: owner.object_name)
>
> ML|||Hi
If the structure of the data file is fixed, then you can create a DTS
package and schedule it as a job to import the data. This will mean that the
user does not have to "manually" import the data. You table structure (and
owner) can then be fixed. If you wish to manipulate the data it may be
worthwhile loading the data into a set of holding tables, where you can
subsequently work with that data and load it into your destination tables.
For more information on DTS look up DTS in books online and at l]
For example if you wish to process several files you can loop through all
the files in a given directory using the example code at
[url]http://www.sqldts.com/default.aspx?246" target="_blank">www.sqldts.com.[/ur
l]...efault.aspx?246
John
"JFB" wrote:

> Hi Everyone,
> I'm still with this problem and now I have little bit of time to find the
> solution.
> After any user import data to a table I want to have that table as dbo
> owner.
> I dont want to give my users full administrator permisssions.
> I try to setup in each database access as db_owner, db_accesmin,
> db_dlladmin but no luck
> I know I can change the owner later with sp_changeobjectowner but sometime
s
> I run crazy with more than three users at the same time.
> How can I fix this issue?
> Tks
> JFB
>
>|||Tks for you answer, I have DTS packages in my enviroment.
What I need is to fix this dbo when the user import data from a text file
manually
Tks
JFB
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:1364EA0B-E2AA-416F-B34F-275CA4B57CC7@.microsoft.com...
> Hi
> If the structure of the data file is fixed, then you can create a DTS
> package and schedule it as a job to import the data. This will mean that
> the
> user does not have to "manually" import the data. You table structure
> (and
> owner) can then be fixed. If you wish to manipulate the data it may be
> worthwhile loading the data into a set of holding tables, where you can
> subsequently work with that data and load it into your destination tables.
> For more information on DTS look up DTS in books online and at
> www.sqldts.com.
> For example if you wish to process several files you can loop through all
> the files in a given directory using the example code at
> http://www.sqldts.com/default.aspx?246
>
> John
> "JFB" wrote:
>|||Hi
It is not clear how/why you allow users to import data manually.
John
"JFB" wrote:

> Tks for you answer, I have DTS packages in my enviroment.
> What I need is to fix this dbo when the user import data from a text file
> manually
> Tks
> JFB
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:1364EA0B-E2AA-416F-B34F-275CA4B57CC7@.microsoft.com...
>
>|||Well each applicator developer has sql enterprise manager to conect to our
sql server with permissions on the database that they are working on it.
Base on bad experiences I don't want they to have full admin permissions.
But they need to import data manually for different purpose.
(analize data, test sp's, test vb app, ...)
Tks
JFB
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:CD8D19DB-CF63-4410-965D-11D31A092965@.microsoft.com...
> Hi
> It is not clear how/why you allow users to import data manually.
> John
>
> "JFB" wrote:
>|||What I need is to fix this dbo when the users(developers) import data from a
text file manually
Tks
JFB
"Louis Davidson" <dr_dontspamme_sql@.hotmail.com> wrote in message
news:ebjR8RVnFHA.1948@.TK2MSFTNGP12.phx.gbl...
> Yeah, a sample table, user, and a query you are trying to run in a script
> would really make this easier.
> Otherwise the best answer (as usual) is 42. Sadly we still don't know the
> question to that answer either :)
> --
> ----
--
> Louis Davidson - http://spaces.msn.com/members/drsql/
> SQL Server MVP
>
> "ML" <ML@.discussions.microsoft.com> wrote in message
> news:77548CF2-DE05-4C93-A509-4BDF04EF49C8@.microsoft.com...
>|||Hi
I have never come across the situation where a programmer has needed to
create tables for testing. If they have test data it should already be
in the destination table format; if this is from a previous version of
the database, then the data is re-exported after an upgrade; if this a
formal import process then the table definitions/process should be
formalised and the dbo owner in place.
If they do need to carry out an activity that may impact other users
then you could give them their own database and make them dbo.
John

Dbo access does not work.

I apologize for leaving of this important bit of information:
Windows Server 2003 Enterprise Edition SP1. Sql Server 2000 SP 4.
Raymond Lewallen
http://www.codebetter.com/blogs/raymond.lewallen

> I have a domain user account, DOM\User1, who I have granted dbo rights
> to
> DatabaseA, which is on a server who is a member of the domain DOM as
> well.
> User1 can add, remove, alter tables and stored procedures etc, but
> when
> User1 attempts to update, select, insert or delete a row from any
> table in
> DatabaseA, even if it is a table User1 just created, the user is given
> a Select/Update/Insert/Delete Permission Denied error, depending on
> the task.
> The only way to get past the problem is to give DOM\User1 system admin
> rights on the server.
> If I create a Sql Server user, UserSql1, and give that user dbo access
> to DatabaseA and attempt to Select/Update/Insert/Delete, then it works
> just fine for UserSql1. Its only the domain accounts that do not work
> correctly.
> Any ideas on this?
> Raymond Lewallen
> http://www.codebetter.com/blogs/raymond.lewallenHi Raymond
There really isn't anything called 'dbo rights'. DBO is a user name in a
database. You can put another user in the db_owner role, but this doesn't
give them the user name dbo. Can you elaborate on exactly what you granted
to DOM\User1?
Is it possible the Windows user belongs to a Windows group that was given
different access to the server and the database?
What is the value of user_name() when DOM\User1 connects to DatabaseA?
HTH
Kalen Delaney, SQL Server MVP
"Raymond Lewallen" <rlewallen@.gmail.com> wrote in message
news:fffd68f614ddba8c861dae82718bc@.news.microsoft.com...
>I have a domain user account, DOM\User1, who I have granted dbo rights to
>DatabaseA, which is on a server who is a member of the domain DOM as well.
>User1 can add, remove, alter tables and stored procedures etc, but when
>User1 attempts to update, select, insert or delete a row from any table in
>DatabaseA, even if it is a table User1 just created, the user is given a
>Select/Update/Insert/Delete Permission Denied error, depending on the task.
> The only way to get past the problem is to give DOM\User1 system admin
> rights on the server.
> If I create a Sql Server user, UserSql1, and give that user dbo access to
> DatabaseA and attempt to Select/Update/Insert/Delete, then it works just
> fine for UserSql1. Its only the domain accounts that do not work
> correctly.
> Any ideas on this?
> Raymond Lewallen
> http://www.codebetter.com/blogs/raymond.lewallen
>|||I have a domain user account, DOM\User1, who I have granted dbo rights to
DatabaseA, which is on a server who is a member of the domain DOM as well.
User1 can add, remove, alter tables and stored procedures etc, but when
User1 attempts to update, select, insert or delete a row from any table in
DatabaseA, even if it is a table User1 just created, the user is given a
Select/Update/Insert/Delete Permission Denied error, depending on the task.
The only way to get past the problem is to give DOM\User1 system admin right
s
on the server.
If I create a Sql Server user, UserSql1, and give that user dbo access to
DatabaseA and attempt to Select/Update/Insert/Delete, then it works just
fine for UserSql1. Its only the domain accounts that do not work correctly.
Any ideas on this?
Raymond Lewallen
http://www.codebetter.com/blogs/raymond.lewallen|||I apologize for leaving of this important bit of information:
Windows Server 2003 Enterprise Edition SP1. Sql Server 2000 SP 4.
Raymond Lewallen
http://www.codebetter.com/blogs/raymond.lewallen

> I have a domain user account, DOM\User1, who I have granted dbo rights
> to
> DatabaseA, which is on a server who is a member of the domain DOM as
> well.
> User1 can add, remove, alter tables and stored procedures etc, but
> when
> User1 attempts to update, select, insert or delete a row from any
> table in
> DatabaseA, even if it is a table User1 just created, the user is given
> a Select/Update/Insert/Delete Permission Denied error, depending on
> the task.
> The only way to get past the problem is to give DOM\User1 system admin
> rights on the server.
> If I create a Sql Server user, UserSql1, and give that user dbo access
> to DatabaseA and attempt to Select/Update/Insert/Delete, then it works
> just fine for UserSql1. Its only the domain accounts that do not work
> correctly.
> Any ideas on this?
> Raymond Lewallen
> http://www.codebetter.com/blogs/raymond.lewallen|||Hi Raymond
There really isn't anything called 'dbo rights'. DBO is a user name in a
database. You can put another user in the db_owner role, but this doesn't
give them the user name dbo. Can you elaborate on exactly what you granted
to DOM\User1?
Is it possible the Windows user belongs to a Windows group that was given
different access to the server and the database?
What is the value of user_name() when DOM\User1 connects to DatabaseA?
HTH
Kalen Delaney, SQL Server MVP
"Raymond Lewallen" <rlewallen@.gmail.com> wrote in message
news:fffd68f614ddba8c861dae82718bc@.news.microsoft.com...
>I have a domain user account, DOM\User1, who I have granted dbo rights to
>DatabaseA, which is on a server who is a member of the domain DOM as well.
>User1 can add, remove, alter tables and stored procedures etc, but when
>User1 attempts to update, select, insert or delete a row from any table in
>DatabaseA, even if it is a table User1 just created, the user is given a
>Select/Update/Insert/Delete Permission Denied error, depending on the task.
> The only way to get past the problem is to give DOM\User1 system admin
> rights on the server.
> If I create a Sql Server user, UserSql1, and give that user dbo access to
> DatabaseA and attempt to Select/Update/Insert/Delete, then it works just
> fine for UserSql1. Its only the domain accounts that do not work
> correctly.
> Any ideas on this?
> Raymond Lewallen
> http://www.codebetter.com/blogs/raymond.lewallen
>|||Raymond Lewallen wrote:
> I have a domain user account, DOM\User1, who I have granted dbo rights
> to DatabaseA, which is on a server who is a member of the domain DOM as
> well. User1 can add, remove, alter tables and stored procedures etc, but
> when User1 attempts to update, select, insert or delete a row from any
> table in DatabaseA, even if it is a table User1 just created, the user
> is given a Select/Update/Insert/Delete Permission Denied error,
> depending on the task.
> The only way to get past the problem is to give DOM\User1 system admin
> rights on the server.
> If I create a Sql Server user, UserSql1, and give that user dbo access
> to DatabaseA and attempt to Select/Update/Insert/Delete, then it works
> just fine for UserSql1. Its only the domain accounts that do not work
> correctly.
> Any ideas on this?
> Raymond Lewallen
> http://www.codebetter.com/blogs/raymond.lewallen
>
Have you explicitly DENIED access to any particular domain groups? Does
DOM\User1 belong to one of those groups?|||Raymond Lewallen wrote:
> I have a domain user account, DOM\User1, who I have granted dbo rights
> to DatabaseA, which is on a server who is a member of the domain DOM as
> well. User1 can add, remove, alter tables and stored procedures etc, but
> when User1 attempts to update, select, insert or delete a row from any
> table in DatabaseA, even if it is a table User1 just created, the user
> is given a Select/Update/Insert/Delete Permission Denied error,
> depending on the task.
> The only way to get past the problem is to give DOM\User1 system admin
> rights on the server.
> If I create a Sql Server user, UserSql1, and give that user dbo access
> to DatabaseA and attempt to Select/Update/Insert/Delete, then it works
> just fine for UserSql1. Its only the domain accounts that do not work
> correctly.
> Any ideas on this?
> Raymond Lewallen
> http://www.codebetter.com/blogs/raymond.lewallen
>
Have you explicitly DENIED access to any particular domain groups? Does
DOM\User1 belong to one of those groups?|||Hello Kalen,
db_owner role is the group the domain account has been assigned access to.
Sorry for the confusion there, in the sql circles I've been in over the
last 10 years, 'dbo rights' have always been understood as the db_owner grou
p.
No windows groups other than BUILTIN\Administrators have been given any expl
icit
rights, and the admins have sa rights.
The value of user_name is DOM\User1 when the user connects.
Raymond Lewallen
http://www.codebetter.com/blogs/raymond.lewallen
[vbcol=seagreen]
> Hi Raymond
> There really isn't anything called 'dbo rights'. DBO is a user name in
> a database. You can put another user in the db_owner role, but this
> doesn't give them the user name dbo. Can you elaborate on exactly what
> you granted to DOM\User1?
> Is it possible the Windows user belongs to a Windows group that was
> given different access to the server and the database?
> What is the value of user_name() when DOM\User1 connects to DatabaseA?
> "Raymond Lewallen" <rlewallen@.gmail.com> wrote in message
> news:fffd68f614ddba8c861dae82718bc@.news.microsoft.com...
>|||Hello Tracy,
No windows groups have been given any rights, whether access or deny, to
the sql server or any of its databases. The only windows group on the entir
e
server is BUILTIN\Administrators, which has sa rights.
Raymond Lewallen
http://www.codebetter.com/blogs/raymond.lewallen

> Raymond Lewallen wrote:
>
> Have you explicitly DENIED access to any particular domain groups?
> Does DOM\User1 belong to one of those groups?
>|||Hello Tracy,
No windows groups have been given any rights, whether access or deny, to
the sql server or any of its databases. The only windows group on the entir
e
server is BUILTIN\Administrators, which has sa rights.
Raymond Lewallen
http://www.codebetter.com/blogs/raymond.lewallen

> Raymond Lewallen wrote:
>
> Have you explicitly DENIED access to any particular domain groups?
> Does DOM\User1 belong to one of those groups?
>

Tuesday, February 14, 2012

DBLIB

Hello!
I have developed a software which uses DBLib to access SQLServer 2000.
I tried if the same software will work with 32 bit version of SQLServer
2005 - there was no problem.
But now I have a customer who has a 64 bit version of SQLServer 2005 and I
urgently need to find solution for using the same software with 64 bit
version of SQLServer 2005.
Do I need a 64 bit ntwdblib.dll?
Has Microsoft implemented a 64 bit version of DBLib?
Thank you!Hi
DBLib is in "Maintenance mode" since SQL Server 7.0. No new functionality is
supplied.
DBLib is not supported on 64 bit, either x64 or IA64.
It is very old technology. Any reason you did not use OLE DB to develop
against?
Regards
--
Mike
This posting is provided "AS IS" with no warranties, and confers no rights.
"ggeshev" <ggeshev@.tonegan.bg> wrote in message
news:O%23fTxr3yGHA.3360@.TK2MSFTNGP03.phx.gbl...
> Hello!
> I have developed a software which uses DBLib to access SQLServer 2000.
> I tried if the same software will work with 32 bit version of SQLServer
> 2005 - there was no problem.
> But now I have a customer who has a 64 bit version of SQLServer 2005 and I
> urgently need to find solution for using the same software with 64 bit
> version of SQLServer 2005.
> Do I need a 64 bit ntwdblib.dll?
> Has Microsoft implemented a 64 bit version of DBLib?
> Thank you!
>|||Michael is right, DB-Lib is not supported on any 64-bit edition.
Here's what it says in Books Online in the topic "Deprecated Database Engine
Features in SQL Server 2005
"Although the SQL Server 2005 Database Engine still supports connections
from existing applications using the DB-Library and Embedded SQL APIs, it
does not include the files or documentation needed to do programming work on
applications that use these APIs. A future version of the SQL Server
Database Engine will drop support for connections from DB-Library or
Embedded SQL applications. Do not use DB-Library or Embedded SQL to develop
new applications. Remove any dependencies on either DB-Library or Embedded
SQL when modifying existing applications. Instead of these APIs, use the
SQLClient namespace or an API such as OLE DB or ODBC. SQL Server 2005 does
not include the DB-Library DLL required to run these applications. To run
DB-Library or Embedded SQL applications you must have available the
DB-Library DLL from SQL Server version 6.5, SQL Server 7.0, or SQL Server
2000."
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
Download the latest version of Books Online from
http://www.microsoft.com/technet/pr...oads/books.mspx
"Michael Epprecht [MSFT]" <michael.epprecht@.online.microsoft.com> wrote
in
message news:%23EBDk%233yGHA.4104@.TK2MSFTNGP02.phx.gbl...
> Hi
> DBLib is in "Maintenance mode" since SQL Server 7.0. No new functionality
> is supplied.
> DBLib is not supported on 64 bit, either x64 or IA64.
> It is very old technology. Any reason you did not use OLE DB to develop
> against?
> Regards
> --
> Mike
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
> "ggeshev" <ggeshev@.tonegan.bg> wrote in message
> news:O%23fTxr3yGHA.3360@.TK2MSFTNGP03.phx.gbl...
>