Wednesday, March 21, 2012
Default access for a login
I create a new login; let's say "aaa" with authentication "SQL Server
Authentication" and no database access specified.
Now... I'm able to connect to my SQL Server 2000 using Query Analyzer with
this "aaa" login and read data/execute stored procedure even I didn't specif
y
any level access. For me looks strange, I was expecting to access a database
after I define a user and permisions using this login. Is this normal?
Thanks!Yes they can connect. In terms of what they can execute
where, that depends.
If a login isn't assigned a database, they will access
databases under the guest account. If guest is in the
database, they have access to the database and whatever
public permissions have been set as well as whatever has
been explicitly granted to the guest user in that database.
Guest always exists in master and tempdb - you can't delete
the account from those databases.
-Sue
On Tue, 27 Sep 2005 14:19:01 -0700, "Radu"
<Radu@.discussions.microsoft.com> wrote:
>Hi guys,
>I create a new login; let's say "aaa" with authentication "SQL Server
>Authentication" and no database access specified.
>Now... I'm able to connect to my SQL Server 2000 using Query Analyzer with
>this "aaa" login and read data/execute stored procedure even I didn't speci
fy
>any level access. For me looks strange, I was expecting to access a databas
e
>after I define a user and permisions using this login. Is this normal?
>
>Thanks!
Sunday, March 11, 2012
Declare or Create cursor
Is Declare Cursor same as Create Cursor and if not what is the major difference?Hello guys,just wanted to ask a question some might percieve it as a stupid one but I don't know so I will ask anyway?
Is Declare Cursor same as Create Cursor and if not what is the major difference?
DECLARE CURSOR is part of the T-SQL Language dfinition. CREATE CURSOR is not.|||I do not think there is "Create Cursor". Does anyone know that?
Friday, March 9, 2012
decimal to numeric conversion
Hi guys,
how do i convert a decimal to numeric data type?
nhoyti:
convert a decimal to numeric data type
what i understood is, you are having a field in database with Decimal datatype and you want to retrieve it as Numeric Field...
you can use CAST() function as..
SELECT CAST(colName AS INT) FROM TABLE
here colName is the Field with Decimal DataType...
hope it helps./.
|||i have a column in my database which is a decimal... and i want to display the decimal to numeric data type
|||
kaushalparik27:
what i understood is, you are having a field in database with Decimal datatype and you want to retrieve it as Numeric Field...
you can use CAST() function as..
SELECT CAST(colName AS INT) FROM TABLE
here colName is the Field with Decimal DataType...
did you try as above solution ??... i think it will convert Decimal to Numeric DataType...
Wednesday, March 7, 2012
Decimal problem
Hi guys,
I've got a table with one of the columns 'ConversionRate' declared as decimal. The value for this column is defined as 1.45. In my vb file, I tried to retrieve the value using a SqlParameter as shown below:
myConversionRate = Me.SqlCommand.Parameters.Add(Sql.StoredProcParameter.ConversionRate, SqlDbType.Decimal)
myConversionRate.Direction = ParameterDirection.Output
which will access the following query in my stored proc:
ALTER PROCEDURE dbo.Charge @.PConversionRateDECIMAL = 0OUTPUT ASSELECT @.PConversionRate = ConversionRate,FROM TblCharge
For some reasons, the value returned is always 1 instead of 1.45. Anyone experienced this problem before and knows how to resolve it? Thanks in advance.
The solution is provided by Microsoft support in the link below. Hope this helps.
http://support.microsoft.com/?kbid=892406
|||I see. Will try that out. Thanks again|||Hmmmm...I've installed the SP4 for SqlServer as suggested in the website but it is still not working. The decimal value is still being rounded into Integer type. Any idea what else might have caused the problem?|||Alter PROCEDURE dbo.Charge@.PConversionRate decimal(18, 2) = 0 OUTPUT
AS
SELECT @.PConversionRate = ConversionRate
FROM TblCharge|||
Silvertype:
Hmmmm...I've installed the SP4 for SqlServer as suggested in the website but it is still not working. The decimal value is still being rounded into Integer type. Any idea what else might have caused the problem?
I did not tell you service pack will fix your problem, you need to go into your SQL Server table and make sure the data type is Decimal and set the precision and scale in your table, in your store proc like the Microsoft code below, in your ADO.NET code and maybe add strings and formatting in your UI and it will not be rounded. Hope this helps.
CREATE PROCEDURE ParameterPrecisionTest(
@.pIn DECIMAL(19,4),
@.pOut DECIMAL(19,4) OUTPUT)
AS
SET @.pOut = @.pIn
ALTER PROCEDURE dbo.Charge
@.PConversionRate DECIMAL = 0 OUTPUT
AS
SELECT @.PConversionRate = ConversionRate,
FROM TblCharge
http://blogs.msdn.com/kathykam/archive/2006/03/29/564426.aspx
Silvertype:
I see. Thanks.
I am glad I could help.
Saturday, February 25, 2012
decimal
I have a data like 28.56 I want only 56, how can I get..
I can get 28 after converting in to Int datatype , what about 56, how can I
get , any buildin function available.
Thanks
NOOR
On Mon, 2 Aug 2004 23:41:31 -0700, Noor wrote:
>Dear guys,
>I have a data like 28.56 I want only 56, how can I get..
>I can get 28 after converting in to Int datatype , what about 56, how can I
>get , any buildin function available.
>Thanks
>NOOR
Hi Noor,
Do you want 0.56 or 56?
Several options are in the script below.
declare @.a decimal(4,2)
set @.a = 28.56
select @.a
select cast(@.a as int)
select @.a - cast(@.a as int)
select (@.a - cast(@.a as int)) * 100
select substring(cast(@.a - cast(@.a as int) as varchar),3,2)
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||Thanks Hugo
Noor
"Hugo Kornelis" <hugo@.pe_NO_rFact.in_SPAM_fo> wrote in message
news:6jpug0h5eoa24b5urkg8sm8hdgnmtm6v5r@.4ax.com... [vbcol=seagreen]
> On Mon, 2 Aug 2004 23:41:31 -0700, Noor wrote:
I
> Hi Noor,
> Do you want 0.56 or 56?
> Several options are in the script below.
> declare @.a decimal(4,2)
> set @.a = 28.56
> select @.a
> select cast(@.a as int)
> select @.a - cast(@.a as int)
> select (@.a - cast(@.a as int)) * 100
> select substring(cast(@.a - cast(@.a as int) as varchar),3,2)
>
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
Tuesday, February 14, 2012
Dealock Statement Type SELECT
I have two stored procs involved. One of them doesn't have a single
modification statement in there nor it calls any other stored procs.
Objects involved in the deadlock are clustered and non- clustered inexes
of the same table. Statement types are SELECT and DELETE.
I guess, my question is, how can a stored proc not making any database
chages get involved in a deadlock?
Below is the trace from the log file:
Wait-for graph
Node: 1
KEY: 8:2135066742:1 (20006e2f6030) CleanCnt:2 Mode: U Flags: 0x0
Grant List 0::
Grant List 1::
Owner: 0x459ae620 Mode: S Flg: 0x0 Ref: 1 Life: 00000000 SPID:
121 ECID: 0
SPID: 121 ECID: 0 Statement Type: SELECT Line #: 171
Input Buf: RPC Event: WF_GetJobProperties; 1 --NOT A SINGLE MOD
STATEMENT IN THIS PROC!!!
Requested By:
ResType: LockOwner Stype:'OR' Mode: X SPID: 90 ECID: 0 Ec :( 0xCC0BB570)
Value: 0x1f9485e0 Cost :( 0/3CB0)
Node: 2
KEY: 8:2135066742:2 (c900b92bd60a) CleanCnt: 2 Mode: X Flags: 0x0
Grant List 0::
Owner: 0x47875c40 Mode: X Flg: 0x0 Ref: 0 Life: 02000000 SPID: 90
ECID: 0
SPID: 90 ECID: 0 Statement Type: DELETE Line #: 52
Input Buf: RPC Event: WF_UpdateRepository; 1
Requested By:
ResType: LockOwner Stype:'OR' Mode: S SPID: 121 ECID:0 Ec :( 0x4CA11570)
Value: 0x843a74c0 Cost :( 0/0)
Victim Resource Owner:
ResType: LockOwner Stype:'OR' Mode: S SPID: 121 ECID: 0 Ec :(
0x4CA11570) Value: 0x843a74c0 Cost :( 0/0)
Your help is greatly appreciated.
Thank you,
Igor
*** Sent via Developersdex http://www.examnotes.net ***Take a look at this msdn article (SQL Server technical bulletin - How
to resolve a deadlock) http://support.microsoft.com/?kbid=832524|||"mEmENT0m0RI" <nospam@.devdex.com> wrote in message
news:erVENq6cGHA.3364@.TK2MSFTNGP05.phx.gbl...
> Hi guys,
> I have two stored procs involved. One of them doesn't have a single
> modification statement in there nor it calls any other stored procs.
> Objects involved in the deadlock are clustered and non- clustered inexes
> of the same table. Statement types are SELECT and DELETE.
> I guess, my question is, how can a stored proc not making any database
> chages get involved in a deadlock?
>
SELECT takes a shared lock 'S' on every key or row it reads. You might read
an index key, locate a row of interest, and then go read that row. You
might place a S lock on the index key, then attempt to place a S lock on the
data row. But a concurrent UPDATE might own an X lock on the data row, and
be attempting to take an X lock on the index key that the SELECT has already
read and locked. Deadlock.
In SQL Server 2005 READ CONCURRENT SNAPSHOT ISOLATION eliminates the need
for the SELECT statement to take S locks in the first place. Instead they
read from the version store to get a consistent view of the database.
David