Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to set default value for field?
Message
General information
Forum:
ASP.NET
Category:
Databases
Miscellaneous
Thread ID:
00818645
Message ID:
00818771
Views:
19
I think I'm getting it...

Thanks, Evan.



>The '@' sign tells T-SQL's parser that it's dealing with a variable, as opposed to a keyword/table name/column name/whatever else. Two of them in a row tells the parser that it's dealing with a system-provided variable (like @@ROWCOUNT, @@IDENTITY, and so forth).
>
>>Aha. I feel much wiser now, thank you <g>
>>
>>Nope, no triggers or formulas—I just did the GetDate() thing, though, with no problems. I appreciate it.
>>
>>BTW, what's all this '@' stuff about, anyway? What does an '@' do? I'm looking at the docs for @local_variable, but it's going way over my head...
>>
>>
>>
>>>Hi Jeff,
>>>
>>>You're right, it *is* easy. (bg)
>>>
>>>I just went into a table with several DateTime columns, and entered
>>>
>>>getdate()
>>>
>>>into the Default Value section of the Table Designer for three of them. SQL Server saved the table just fine (albeit placing an extra set of parentheses around what I typed).
>>>
>>>Could you possibly have a trigger or a formula specified for the column in question?
>>>
>>>
>>>>This is easy in FoxPro, of course, so I'm thinking it must be just as easy in MS-SQL, and that I only need to find out the right syntax.
>>>>
>>>>I've created a DateTime field, and I want it to automatically populate with the current system date & time when a record is added.
>>>>
>>>>Trouble is, whenever I try to enter anything—anything at all—into the Default Value field in Table Designer, I get an error: "Error validating the default for column 'tPaymentReceivedDate'."
>>>>
>>>>What's an overworked genius to do?
>>>>
>>>>TIA,
>>>>Jeff

Read about the greatest fraud in the history of mankind.
See TaxableIncome.net.
Previous
Reply
Map
View

Click here to load this message in the networking platform