Showing posts with label value. Show all posts
Showing posts with label value. Show all posts

Friday, March 30, 2012

How to shrink my database

hello

i know how to do shrinking DBCC SHRINKDATABASE( XXX,10).

But my question is how we know minumum shrinking Database value through stroed procedure.

please help me i need to shrink Database.

thanx

kiran

Kiran,

With DBCC SHRINKDATABASE, you specify the percentage of free space to leave after the shrink. i.e. : in your example,"10" will leave about 10 % free space after the shrink.

DBCC SHRINKFILE allows you to shrink a specific file within the database (i.e. : the transaction log or one of the data files). If the value you specify for target size is less than the minimum size, it will shrink the file to the minimum possible, therefore, if you specify "1", then it will shrink to the minimum possible.

Examples ;

DBCC SHRINKDATABASE (northwind, 10) -- Leaves about 10 % free space after the shrink

DBCC SHRINKFILE (datafile, 5) -- Shrinks "datafile" to 5 MB (or the minimum possible if more than 5 MB used)

Rod.

|||

thanx for you response rod.

but i have some small question can u we put defaulut "1" every time

like DBCC SHRINKDATABASE (northwind, 1) ?

regards

kiran

|||I wouldn't do that if I were you. If your autogrow property is not enabled, you end up with a non-functional database in no time.

Wednesday, March 28, 2012

How to setup two equal databases environment

Dear all,
I have an application running on a production database. And now, I
want to change a column of data to another of value and compare the result
between them. Since the data in production is changing. I need to
synchronize two set of data except the testing data. For do that, I build
replication on these two database. This is my first time using replication.
I found there's an initialize error on during synchronization job. Is there
any guideline on setup replication? Thanks
Rdgs
Ellis
Ellis,
can you explain this in a little more detail using column names and
explaining the relationship between the databases. Also, what type of
replication have you implemented.
TIA,
Paul Ibison
sql

Monday, March 26, 2012

How to share parameter value between main and subreport?

Hi All,

I am really lousy when it comes to creating reports. So I am seeking your expert advise/experience.

I have a report that uses a stored-procedure as its data source. This procedure has a parameter. Within this report, I created a subreport which also sources to yet another stored-procedure that also has a parameter which expects the same value as the param of the main report.

When I run the report, say in preview mode, I do not want to be prompted with the parameter twice (i.e. once for the main report, and another for the subreport). How can I edit/modify subreport so that in its select or formula it will say something like:

{?@.ParamOfSubReport} = {?@.ParamOfMainReport}

Many thanks in advance.

_msd_You need to use shared variable and you can use it anywhere in the report|||Right click on your sub-report and choose "Change sub-report links".

Example:

"?parameter1" in the main report links to "?Pm-?parameter1" in the sub-report, then choose the field in the datasource that the parameter is tested against.

When you enter the parameter in your main report it will be passed to the sub-report preview also.|||How do I pass a value returned from the stored proc in the main report to the sub report. I'm getting an error "cannot link from stored procedure" when I pass the value from main report to subreport using subreport links.

Immediate response would be appreciated. Thanks.|||Assign value to shared variable and use that in Sub report|||Hi, I saw this old thread and I am working on the same issue. I'm working on a simple dumb shell of a report in Crystal 8.5 as a test for how to pass parameters into a sql server 2000 stored procedure via a subreport. I'd like to deliver this as straight Crystal without using vb or other shells to call the report from.

Eventually I need to modify a copy of a main report with data and about 8 subreports, all pulling from stored procedures using one parameter called ID. I am getting many requests for this ID parameter, for each subreport, even though I am linking the parameters via subreport links.

The subreport wants to link into the stored procedure using the parameter name from the stored procedure, which is @.ID. The main report only wants to give the subreport a subordinate link such as ?Pm-@.ID. I cannot name the stored procedure parameter with a name like ?Pm-@.ID because it violates the rules of transact-sql. It sees the hyphen as a subtraction. I can see the logic of using the same variable names, but how do I get rid of that bothersome hyphen?

I have also tried using shared variables and they connect to the subreport ok, but I'm still not closing the loop by linking into the stored procedure based on the shared variable.

I am trying to use the same information in multiple places without making the user enter the same information over and over again.

Has anyone had this problem before?sql

How to setup two equal databases environment

Dear all,
I have an application running on a production database. And now, I
want to change a column of data to another of value and compare the result
between them. Since the data in production is changing. I need to
synchronize two set of data except the testing data. For do that, I build
replication on these two database. This is my first time using replication.
I found there's an initialize error on during synchronization job. Is there
any guideline on setup replication? Thanks
Rdgs
EllisEllis,
can you explain this in a little more detail using column names and
explaining the relationship between the databases. Also, what type of
replication have you implemented.
TIA,
Paul Ibison

How to setup two equal databases environment

Dear all,
I have an application running on a production database. And now, I
want to change a column of data to another of value and compare the result
between them. Since the data in production is changing. I need to
synchronize two set of data except the testing data. For do that, I build
replication on these two database. This is my first time using replication.
I found there's an initialize error on during synchronization job. Is there
any guideline on setup replication? Thanks
Rdgs
Ellis
Ellis,
can you explain this in a little more detail using column names and
explaining the relationship between the databases. Also, what type of
replication have you implemented.
TIA,
Paul Ibison

How to setup two equal databases environment

Dear all,
I have an application running on a production database. And now, I
want to change a column of data to another of value and compare the result
between them. Since the data in production is changing. I need to
synchronize two set of data except the testing data. For do that, I build
replication on these two database. This is my first time using replication.
I found there's an initialize error on during synchronization job. Is there
any guideline on setup replication? Thanks
Rdgs
EllisEllis,
can you explain this in a little more detail using column names and
explaining the relationship between the databases. Also, what type of
replication have you implemented.
TIA,
Paul Ibison

Friday, March 23, 2012

How to setup permissions by using field value?

Hello, I need some help. I am modifying a database that will be accessed by people in different parts of the world. I am trying to set user roles to show only records in each Location. Here is an example:

User Groups
Boston Users
New York Users
London Users

Database: machines
Table: tblmachines
fldname fldoperatingsystem fldgeocenter
--- -------- -----
foo.mydomain.com Windows 2000 BOSTON
loo.mydomain.com Windows NT 4.0 NEW YORK
moo.mydomain.com REDHAT LINUX LONDON

How do I configure user roles so that only users from Boston see Boston records, and users from New York see New York records etc etc? I am trying to key off the fldgeocenter field Any suggestions would be MOST welcome.User Roles doesn't help here.
The database roles does not help here.
The best way to filter the records horizontally is to implement stored procedures where "fldgeocenter" would be an input parameter. Use the value of that param. to filter the records in the WHERE statement.

Originally posted by dperrott
Hello, I need some help. I am modifying a database that will be accessed by people in different parts of the world. I am trying to set user roles to show only records in each Location. Here is an example:

User Groups
Boston Users
New York Users
London Users

Database: machines
Table: tblmachines
fldname fldoperatingsystem fldgeocenter
--- -------- -----
foo.mydomain.com Windows 2000 BOSTON
loo.mydomain.com Windows NT 4.0 NEW YORK
moo.mydomain.com REDHAT LINUX LONDON

How do I configure user roles so that only users from Boston see Boston records, and users from New York see New York records etc etc? I am trying to key off the fldgeocenter field Any suggestions would be MOST welcome.

How to setup LockTime value?

When I set the deadlock timeout value by "set @.@.lock_timeout", if I log off
from the server, the value will be set to the default value "-1".
How to set up the value, which can be applied where the server start up?
Thanks.
AlistairLock timeout can not be set that way... sorry...( and do not remember any
Trace flags which allow it to be set for all users either.)
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Alistair" <anonymous@.discussions.microsoft.com> wrote in message
news:6D258EAB-7A0F-44D6-AB4A-DFEB1D7EE74E@.microsoft.com...
quote:

> When I set the deadlock timeout value by "set @.@.lock_timeout", if I log

off from the server, the value will be set to the default value "-1".
quote:

> How to set up the value, which can be applied where the server start up?
> Thanks.
> Alistair
sql

How to setup LockTime value?

When I set the deadlock timeout value by "set @.@.lock_timeout", if I log off from the server, the value will be set to the default value "-1".
How to set up the value, which can be applied where the server start up?
Thanks.
AlistairLock timeout can not be set that way... sorry...( and do not remember any
Trace flags which allow it to be set for all users either.)
--
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Alistair" <anonymous@.discussions.microsoft.com> wrote in message
news:6D258EAB-7A0F-44D6-AB4A-DFEB1D7EE74E@.microsoft.com...
> When I set the deadlock timeout value by "set @.@.lock_timeout", if I log
off from the server, the value will be set to the default value "-1".
> How to set up the value, which can be applied where the server start up?
> Thanks.
> Alistair

Wednesday, March 21, 2012

How to setup default value using GETDATE?

Hi, All
On Northwind database in SQL Server 2000, I try to setup default value at
table design windows for "OrderDate" using GETDATE(), but it does not work.
How do I use setup GETDATE default value for date type? Thanks

KaiOn Sun, 09 May 2004 03:39:07 GMT, kai wrote:

>Hi, All
> On Northwind database in SQL Server 2000, I try to setup default value at
>table design windows for "OrderDate" using GETDATE(), but it does not work.
>How do I use setup GETDATE default value for date type? Thanks
>Kai

Hi Kai,

ALTER TABLE MyTable
ADD DEFAULT GETDATE() FOR MyColumn
go

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)|||What do you mean exactly by 'it does not work'? Note that the default value
is used only when the column is omitted from the INSERT column list.

To add to Hugo's response, it's a good idea to name constraints explicitly
so that subsequent schema maintenance is easier:

ALTER TABLE MyTable
ADD CONSTRAINT DF_MyTable_MyColumn
DEFAULT GETDATE() FOR MyColumn

--
Hope this helps.

Dan Guzman
SQL Server MVP

"kai" <kailiang@.earthlink.net> wrote in message
news:vJhnc.3578$KE6.2982@.newsread3.news.atl.earthl ink.net...
> Hi, All
> On Northwind database in SQL Server 2000, I try to setup default value
at
> table design windows for "OrderDate" using GETDATE(), but it does not
work.
> How do I use setup GETDATE default value for date type? Thanks
> Kaisql

how to Set variable value in sub package?

hi !

how to set variable value for sub package inside another package?

some thing like this:

xp_cmdshell 'dtexec /f \"D:\\SSISProject\\Integration Services Project1\\ArchiveMainMultiTables.dtsx\" /Set \package.Variables[User::ArchivePackageName].Properties[Value];\"ArchiveTicketLog\" /Set \package.Variables[User::ArchiveFileType].Properties[Value];\"text\" /Set \package.Variables[User::connectst].Properties[Value];\"Data/tSource=SE413695\AASQL2005;Initial/tCatalog=TestDB;Provider=SQLNCLI.1;Integrated/tSecurity=SSPI;\[ConnectionString]'

Main Package = ArchiveMainMultiTables.dtsx

sub packge = ArchiveTicketLog. when i try to execute the sub pacakge it thorughs up error saying the connection string in not set. i am setting in the parent connection string of the main package. when i execute through the pacakge itself it works fine but when i execute through the Sql command line it fails.

is there some thing to to "/Set [package name]\Package.Connections[ConnectStringArchiveTicket].Properties[Value];

please help

thanks

jas

Have you looked at parent package configurations?

Kirk Haselden
Author "SQL Server Integration Services"

|||

Some links here that may help as well:

Accessing variables in a parent package
(http://blogs.conchango.com/jamiethomson/archive/2005/09/01/2096.aspx)

Passing variables between packages
(http://blogs.conchango.com/jamiethomson/archive/2005/03/17/1151.aspx)

-Jamie

|||thanks

how to set up unique combinational constraint

Hi I have a table and I do not want to allow entries if two column value
match, for example
table 1
id type name value
int varchar20 varchar20 int
1 test paul 2
if name is paul and value is 3 allow insert
if name is paul and value is 2 do not allow insert.
I am trying to do this with under the index/keys menu, not quite sure how to
do it and if this is correct.
Thanks.
--
Paul G
Software engineer.If you just want to prevent the combination from being inserted into the
table, you can use an INSERT trigger. If you want the condition to always
hold for all the rows in the table, you can create a CHECK constraint on the
table.
Linchi
"Paul" wrote:
> Hi I have a table and I do not want to allow entries if two column value
> match, for example
> table 1
> id type name value
> int varchar20 varchar20 int
> 1 test paul 2
> if name is paul and value is 3 allow insert
> if name is paul and value is 2 do not allow insert.
> I am trying to do this with under the index/keys menu, not quite sure how to
> do it and if this is correct.
> Thanks.
> --
> Paul G
> Software engineer.|||Consider putting a UNIQUE constraint on (name, value)
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau
"Linchi Shea" <LinchiShea@.discussions.microsoft.com> wrote in message
news:23467935-67F3-418E-A24E-200CE74DD637@.microsoft.com...
If you just want to prevent the combination from being inserted into the
table, you can use an INSERT trigger. If you want the condition to always
hold for all the rows in the table, you can create a CHECK constraint on the
table.
Linchi
"Paul" wrote:
> Hi I have a table and I do not want to allow entries if two column value
> match, for example
> table 1
> id type name value
> int varchar20 varchar20 int
> 1 test paul 2
> if name is paul and value is 3 allow insert
> if name is paul and value is 2 do not allow insert.
> I am trying to do this with under the index/keys menu, not quite sure how
to
> do it and if this is correct.
> Thanks.
> --
> Paul G
> Software engineer.|||I think I need the check constraint, I do not want any duplicates in the
table using both columns.
for example
id type name value
int varchar20 varchar20 int
1 test paul 2
2 test1 paul 3 ok
3 test2 tom 2 ok
4 test3 tom 3 ok
5 test4 tom 2 **do not allow this
entry**
Paul G
Software engineer.
"Linchi Shea" wrote:
> If you just want to prevent the combination from being inserted into the
> table, you can use an INSERT trigger. If you want the condition to always
> hold for all the rows in the table, you can create a CHECK constraint on the
> table.
> Linchi
> "Paul" wrote:
> > Hi I have a table and I do not want to allow entries if two column value
> > match, for example
> > table 1
> >
> > id type name value
> > int varchar20 varchar20 int
> > 1 test paul 2
> >
> > if name is paul and value is 3 allow insert
> > if name is paul and value is 2 do not allow insert.
> >
> > I am trying to do this with under the index/keys menu, not quite sure how to
> > do it and if this is correct.
> > Thanks.
> > --
> > Paul G
> > Software engineer.|||Actually, you want a UNIQUE constraint on (name, value):
alter table MyTable
add
constraint UK_MyTable UNIQUE (name, value)
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:65E03382-8002-4FCE-8531-6EA764838D75@.microsoft.com...
I think I need the check constraint, I do not want any duplicates in the
table using both columns.
for example
id type name value
int varchar20 varchar20 int
1 test paul 2
2 test1 paul 3 ok
3 test2 tom 2 ok
4 test3 tom 3 ok
5 test4 tom 2 **do not allow this
entry**
Paul G
Software engineer.
"Linchi Shea" wrote:
> If you just want to prevent the combination from being inserted into the
> table, you can use an INSERT trigger. If you want the condition to always
> hold for all the rows in the table, you can create a CHECK constraint on
the
> table.
> Linchi
> "Paul" wrote:
> > Hi I have a table and I do not want to allow entries if two column value
> > match, for example
> > table 1
> >
> > id type name value
> > int varchar20 varchar20 int
> > 1 test paul 2
> >
> > if name is paul and value is 3 allow insert
> > if name is paul and value is 2 do not allow insert.
> >
> > I am trying to do this with under the index/keys menu, not quite sure
how to
> > do it and if this is correct.
> > Thanks.
> > --
> > Paul G
> > Software engineer.|||ok thanks. Since I do not care if they are unique in a single column but
need to look at both columns together would I need to change the statement or
would the statement below still work
thanks?
alter table MyTable
add
constraint UK_MyTable UNIQUE (name, value)
column1 column2
paul 1 ok
paul 2 ok
paul 1 do not allow this entry match(value
in column1 and column2 matches value in column1 and column2 in previous
entry).
--
Paul G
Software engineer.
"Tom Moreau" wrote:
> Actually, you want a UNIQUE constraint on (name, value):
> alter table MyTable
> add
> constraint UK_MyTable UNIQUE (name, value)
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> SQL Server MVP
> Toronto, ON Canada
> https://mvp.support.microsoft.com/profile/Tom.Moreau
>
> "Paul" <Paul@.discussions.microsoft.com> wrote in message
> news:65E03382-8002-4FCE-8531-6EA764838D75@.microsoft.com...
> I think I need the check constraint, I do not want any duplicates in the
> table using both columns.
> for example
> id type name value
> int varchar20 varchar20 int
> 1 test paul 2
> 2 test1 paul 3 ok
> 3 test2 tom 2 ok
> 4 test3 tom 3 ok
> 5 test4 tom 2 **do not allow this
> entry**
>
> --
> Paul G
> Software engineer.
>
> "Linchi Shea" wrote:
> > If you just want to prevent the combination from being inserted into the
> > table, you can use an INSERT trigger. If you want the condition to always
> > hold for all the rows in the table, you can create a CHECK constraint on
> the
> > table.
> >
> > Linchi
> >
> > "Paul" wrote:
> >
> > > Hi I have a table and I do not want to allow entries if two column value
> > > match, for example
> > > table 1
> > >
> > > id type name value
> > > int varchar20 varchar20 int
> > > 1 test paul 2
> > >
> > > if name is paul and value is 3 allow insert
> > > if name is paul and value is 2 do not allow insert.
> > >
> > > I am trying to do this with under the index/keys menu, not quite sure
> how to
> > > do it and if this is correct.
> > > Thanks.
> > > --
> > > Paul G
> > > Software engineer.
>
>|||The code I gave you is what you need, since it specifies that the uniqueness
is to be applied to the combination of both columns.
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:D044B7E2-3B9A-4B19-84A9-AADDA4AEBE2A@.microsoft.com...
ok thanks. Since I do not care if they are unique in a single column but
need to look at both columns together would I need to change the statement
or
would the statement below still work
thanks?
alter table MyTable
add
constraint UK_MyTable UNIQUE (name, value)
column1 column2
paul 1 ok
paul 2 ok
paul 1 do not allow this entry match(value
in column1 and column2 matches value in column1 and column2 in previous
entry).
--
Paul G
Software engineer.
"Tom Moreau" wrote:
> Actually, you want a UNIQUE constraint on (name, value):
> alter table MyTable
> add
> constraint UK_MyTable UNIQUE (name, value)
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> SQL Server MVP
> Toronto, ON Canada
> https://mvp.support.microsoft.com/profile/Tom.Moreau
>
> "Paul" <Paul@.discussions.microsoft.com> wrote in message
> news:65E03382-8002-4FCE-8531-6EA764838D75@.microsoft.com...
> I think I need the check constraint, I do not want any duplicates in the
> table using both columns.
> for example
> id type name value
> int varchar20 varchar20 int
> 1 test paul 2
> 2 test1 paul 3 ok
> 3 test2 tom 2 ok
> 4 test3 tom 3 ok
> 5 test4 tom 2 **do not allow
this
> entry**
>
> --
> Paul G
> Software engineer.
>
> "Linchi Shea" wrote:
> > If you just want to prevent the combination from being inserted into the
> > table, you can use an INSERT trigger. If you want the condition to
always
> > hold for all the rows in the table, you can create a CHECK constraint on
> the
> > table.
> >
> > Linchi
> >
> > "Paul" wrote:
> >
> > > Hi I have a table and I do not want to allow entries if two column
value
> > > match, for example
> > > table 1
> > >
> > > id type name value
> > > int varchar20 varchar20 int
> > > 1 test paul 2
> > >
> > > if name is paul and value is 3 allow insert
> > > if name is paul and value is 2 do not allow insert.
> > >
> > > I am trying to do this with under the index/keys menu, not quite sure
> how to
> > > do it and if this is correct.
> > > Thanks.
> > > --
> > > Paul G
> > > Software engineer.
>
>

Monday, March 19, 2012

How to set up auto incrementing for a field

I have a database table. I need to set a particular data field to allow for Auto Incrementing. Basically I need to set up the initial integer value to start at. Then to specify the amount to increment by.

What I have done so far is to right click on the field name in SQL Server 2005. Then, on the pop-up menu I select the menu option for properties.

When the properties are displayed I see some fields listed in dark grey but I am not able to edit these fields. In other words, if I try to type text in this field, nothing happens. The fields I am talking about are:

Identity Increment

Identity Seed

Is Identity

Does anyone know what the problem is? What do I have to do to edit these fields.

Check if you have the necessary permissions.|||You can not change the properties directly in the Column Properties window, instead, you can right click the column and choose 'Modify'. Enjoy itSmile

Monday, March 12, 2012

How to set the parameter's default value dynamically?

Hi all,

Does anybody know how to set the parameter's default value dynamically?

I'm working on a report with some parameters against datacube, and I hope the default value of one of the parameters could be set dynamically based on the user's login.

Thanks,

Jone

Jone,

In your Report Parameter - Default Values - Non-Queries you can place an expression like so:

=IIf(User!UserID = "Bob", "USA","Canada")

I hope this is what you were looking for.

Ham

How to set the default value for a datetime culomn?

I try to set a default value (getdate()) for a datetime culomn in sql mobile,
but got error when i insert record:

there was a syntax error in the date format. [expression = getdate()]

may be I can only set a exict date ?

If you want to insert current datetime by calling getdate() method, then it is possible in sql server everywhere. you can do like this;

insert into employee values (4,'John',25, getdate())

This will insert current datetime in the fourth column (in above example).

Please let me know if it answers your question.

Thanks

Sachin

|||

It is just getdate()

Not (getdate())

|||do u mean in sql werver or in asp.net|||Duh ,

He encapsulated it in an expression which started with a ( and so it ended with a ) It is correct. He did not just use the function getdate() as you indicated here.

How to set the default value for a datetime culomn?

I try to set a default value (getdate()) for a datetime culomn in sql mobile,
but got error when i insert record:

there was a syntax error in the date format. [expression = getdate()]

may be I can only set a exict date ?

If you want to insert current datetime by calling getdate() method, then it is possible in sql server everywhere. you can do like this;

insert into employee values (4,'John',25, getdate())

This will insert current datetime in the fourth column (in above example).

Please let me know if it answers your question.

Thanks

Sachin

|||

It is just getdate()

Not (getdate())

|||do u mean in sql werver or in asp.net|||Duh ,

He encapsulated it in an expression which started with a ( and so it ended with a ) It is correct. He did not just use the function getdate() as you indicated here.

How to set the default value for a datetime culomn?

I try to set a default value (getdate()) for a datetime culomn in sql mobile,
but got error when i insert record:

there was a syntax error in the date format. [expression = getdate()]

may be I can only set a exict date ?

If you want to insert current datetime by calling getdate() method, then it is possible in sql server everywhere. you can do like this;

insert into employee values (4,'John',25, getdate())

This will insert current datetime in the fourth column (in above example).

Please let me know if it answers your question.

Thanks

Sachin

|||

It is just getdate()

Not (getdate())

|||do u mean in sql werver or in asp.net|||Duh ,

He encapsulated it in an expression which started with a ( and so it ended with a ) It is correct. He did not just use the function getdate() as you indicated here.

How to set the default value for a datetime culomn?

I try to set a default value (getdate()) for a datetime culomn in sql mobile,
but got error when i insert record:

there was a syntax error in the date format. [expression = getdate()]

may be I can only set a exict date ?

If you want to insert current datetime by calling getdate() method, then it is possible in sql server everywhere. you can do like this;

insert into employee values (4,'John',25, getdate())

This will insert current datetime in the fourth column (in above example).

Please let me know if it answers your question.

Thanks

Sachin

|||

It is just getdate()

Not (getdate())

|||do u mean in sql werver or in asp.net|||Duh ,

He encapsulated it in an expression which started with a ( and so it ended with a ) It is correct. He did not just use the function getdate() as you indicated here.

How to set the default value for a datetime culomn?

I try to set a default value (getdate()) for a datetime culomn in sql mobile,
but got error when i insert record:

there was a syntax error in the date format. [expression = getdate()]

may be I can only set a exict date ?

If you want to insert current datetime by calling getdate() method, then it is possible in sql server everywhere. you can do like this;

insert into employee values (4,'John',25, getdate())

This will insert current datetime in the fourth column (in above example).

Please let me know if it answers your question.

Thanks

Sachin

|||

It is just getdate()

Not (getdate())

|||do u mean in sql werver or in asp.net|||Duh ,

He encapsulated it in an expression which started with a ( and so it ended with a ) It is correct. He did not just use the function getdate() as you indicated here.

how to set the default value

I have database in sql server. One field called datesent, i would like to set the default value as now(), i just type in the default value in database design, it didn't work. Please help, many thanks.try this: getdate()|||It works, thank you very much!|||I use the getdate() as the default value. But i found the value like "
11/8/2005 10:14:00 AM. How can i set the default value like the format as:
11/8/2005. Thanks.|||hi,

try this

create table yourTable
(
ColumnName datetime default convert(varchar,getdate(),107)
)