Showing posts with label whenever. Show all posts
Showing posts with label whenever. Show all posts

Friday, February 17, 2012

default value

How do i setup the table so that the default date enters the current
date whenever someone enters a record.
vjYou can add a default constraint for the column with a value consisting
of only the date portion of the CURRENT_TIMESTAMP (or GETDATE()). For
example:

ALTER TABLE MyTable
ADD CONSTRAINT DF_MyTable_MyDateColumn
DEFAULT
CAST(CONVERT(char(8), CURRENT_TIMESTAMP, 112) AS smalldatetime)
FOR MyDateColumn

--
Hope this helps.

Dan Guzman
SQL Server MVP

--------
SQL FAQ links (courtesy Neil Pike):

http://www.ntfaq.com/Articles/Index...epartmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
--------

"Vincent Jones" <vncntj@.hotmail.com> wrote in message
news:ba2a2d30.0310101710.94d2ff5@.posting.google.co m...
> How do i setup the table so that the default date enters the current
> date whenever someone enters a record.
> vj

default table permissions

Hi there,
How can I give full default permissions to a few users whenever I
create a new table in a database in SQL2000? Thanks
Hi,
You can assign the users to the db_owner role in the database. This should
give them full permission on that database.
In case you want users to have full control of SQL Server, you can assign
the login to the serveradmin role.
Thank you.
Regards,
Karthik
"Tester" wrote:

> Hi there,
> How can I give full default permissions to a few users whenever I
> create a new table in a database in SQL2000? Thanks
>
|||I'm not sure exactly what you mean by 'full default permissions'. If you
want those users to have only SELECT, INSERT, UPDATE and DELETE for all
tables in the database, you can add the users to the db_datareader and
db_datawriter roles.
If you want those users to have SELECT, INSERT, UPDATE and DELETE on only
certain tables, then you'll need to grant those permissions individually. I
suggest you create a role and add the desired users to that role:
EXEC sp_addrole 'FullTableRole'
EXEC sp_addrolemember 'FullTableRole', User1'
EXEC sp_addrolemember 'FullTableRole', User2'
GO
After you create a new table:
GRANT SELECT, INSERT, UPDATE, DELETE ON dbo.MyNewTable TO FullTableRole
Hope this helps.
Dan Guzman
SQL Server MVP
"Tester" <calinguga@.netscape.net> wrote in message
news:1179436343.187305.31290@.w5g2000hsg.googlegrou ps.com...
> Hi there,
> How can I give full default permissions to a few users whenever I
> create a new table in a database in SQL2000? Thanks
>

default table permissions

Hi there,
How can I give full default permissions to a few users whenever I
create a new table in a database in SQL2000? ThanksHi,
You can assign the users to the db_owner role in the database. This should
give them full permission on that database.
In case you want users to have full control of SQL Server, you can assign
the login to the serveradmin role.
Thank you.
Regards,
Karthik
"Tester" wrote:
> Hi there,
> How can I give full default permissions to a few users whenever I
> create a new table in a database in SQL2000? Thanks
>|||I'm not sure exactly what you mean by 'full default permissions'. If you
want those users to have only SELECT, INSERT, UPDATE and DELETE for all
tables in the database, you can add the users to the db_datareader and
db_datawriter roles.
If you want those users to have SELECT, INSERT, UPDATE and DELETE on only
certain tables, then you'll need to grant those permissions individually. I
suggest you create a role and add the desired users to that role:
EXEC sp_addrole 'FullTableRole'
EXEC sp_addrolemember 'FullTableRole', User1'
EXEC sp_addrolemember 'FullTableRole', User2'
GO
After you create a new table:
GRANT SELECT, INSERT, UPDATE, DELETE ON dbo.MyNewTable TO FullTableRole
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Tester" <calinguga@.netscape.net> wrote in message
news:1179436343.187305.31290@.w5g2000hsg.googlegroups.com...
> Hi there,
> How can I give full default permissions to a few users whenever I
> create a new table in a database in SQL2000? Thanks
>

default table permissions

Hi there,
How can I give full default permissions to a few users whenever I
create a new table in a database in SQL2000? ThanksHi,
You can assign the users to the db_owner role in the database. This should
give them full permission on that database.
In case you want users to have full control of SQL Server, you can assign
the login to the serveradmin role.
Thank you.
Regards,
Karthik
"Tester" wrote:

> Hi there,
> How can I give full default permissions to a few users whenever I
> create a new table in a database in SQL2000? Thanks
>|||I'm not sure exactly what you mean by 'full default permissions'. If you
want those users to have only SELECT, INSERT, UPDATE and DELETE for all
tables in the database, you can add the users to the db_datareader and
db_datawriter roles.
If you want those users to have SELECT, INSERT, UPDATE and DELETE on only
certain tables, then you'll need to grant those permissions individually. I
suggest you create a role and add the desired users to that role:
EXEC sp_addrole 'FullTableRole'
EXEC sp_addrolemember 'FullTableRole', User1'
EXEC sp_addrolemember 'FullTableRole', User2'
GO
After you create a new table:
GRANT SELECT, INSERT, UPDATE, DELETE ON dbo.MyNewTable TO FullTableRole
Hope this helps.
Dan Guzman
SQL Server MVP
"Tester" <calinguga@.netscape.net> wrote in message
news:1179436343.187305.31290@.w5g2000hsg.googlegroups.com...
> Hi there,
> How can I give full default permissions to a few users whenever I
> create a new table in a database in SQL2000? Thanks
>