Setting Default Value (concatenated String) Of Column Using UDF
Oct 23, 2005
Hello,
I'm trying to set the default value of a column (SysInvNum) in a table (caseform) of mine by concatenating 3 other fields in the same table. These other fields are all Integer datatypes. they are "CaseYear" e.g. (2005), "InvNum" e.g. (0001) and "PostId" e.g. (5).
So basically the SysInvNum column for this row should read '200500015'
When I run a basic query using the CAST or CONVERT functions like this:
SELECT convert (varchar,caseyear) + convert(varchar,InvNum) + convert(varchar,postid) from caseform
OR
SELECT cast(caseyear as varchar(4)) + cast(InvNum as varchar(4)) + cast(postid as varchar(1)) from caseform
I get the results I want. But since I want this value to be the default value of the column, I tried inserting this: convert (varchar,caseyear) + convert(varchar,InvNum) + convert(varchar,postid) into the default value parameter of the column in the caseform table. The result is a string that is the query itself.
I then tried creating a UDF called getsysinvnum() where I declare and set 2 variables whilst returning one of the variables as a varchar. An example of what it looks like is this:
CREATE FUNCTION GetSysInvNum()
RETURNS varchar
AS
BEGIN
DECLARE @maxcaseid Int
DECLARE @sysinvnum varchar
SELECT @maxcaseid = max (caseid) from caseform
SELECT @sysinvnum = cast(caseyear as varchar(4)) + cast(invnum as varchar(4)) + cast(postid as varchar(1)) from caseform where caseid = @maxcaseid
RETURN @sysinvnum
END
The result I get when I plug this into the default value of the column as : ([dbo].[getsysinvnum]()) is "2".
Yes it returns the number "2" could someone please tell me what I am doing wrong, or suggest a better way for me to do this?
Thanks in advance
'Wale
View 10 Replies
ADVERTISEMENT
Dec 6, 2007
In the Column Properties window's 'Default Value or Binding' property, how do you specify an empty string?
Thanks.
View 5 Replies
View Related
Sep 23, 2005
How do I prevent the following null 'Answer'?This SQL will return a null string for 'Answer' whenever the count is null either for 'subquery-1' or for 'subquery-2', even though the other is not null. I need a string in either case. It would be better to have 'Answer' be "f1=, f2=25" than to have nothing. It doesn't seem right that both COUNT's have to be non-null to get anything other than null for the concatenated 'Answer'. There ought to be a way for COUNT to return 0 in some cases where it now returns null. I'd expect/prefer an 'Answer' of "f1=0, f2=25" or maybe even "f1=<null>, f2=25".I expect I'd have the same problem with nulls even if I wasn't using subqueries.SELECT 'f1='+CAST(COUNT(subquery-1) AS VARCHAR)+', f2='+CAST(COUNT(subquery-2) AS VARCHAR) AS AnswerFROM table1WHERE condition=5GROUP BY fieldX
View 1 Replies
View Related
Oct 5, 2007
declare @filter varchar(100)
set @filter = '10,''firststring''||10,''secondstring'''
declare @tbl table
(id decimal,
name varchar(20))
insert into @tbl values (substring(@filter,0,patindex('%||%',@filter)))
hai in the above exmaple, i recieve input value (@filter) as concated string . pipeline(||) is my delimiter..
i want to split the string based on this delimater and need to insert into @tbl..
There are more columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.
What is the error in this. i believe i can do this way to insert to concatinated values.
Help pls
View 6 Replies
View Related
Mar 31, 2008
So I've run into another problem. I've figured out how to concatenate multiple rows into a single string my only problem is using that on another query with multiple rows...Basically what I'm trying to do is pull up information for each class a student has in his/her profile and while at it pull up any prerequisite classes that are associated with a certain class. So the final query would look something like this...
StudClassID Completed Class ID Name Description Credits Prereq... rest are insignificant...
0 0 CSC200 Cool prog... blah.... 3 CSC160, CSC180
I get the concept of the coalesce and cast just i'm not understanding how to get it to work with each return on the main select...anyways below are the tables and my current query call...
Code Snippet
USE [C:PROGRAM FILESMICROSOFT SQL SERVERMSSQL.1MSSQLDATACOLLEGE.MDF]
GO
/****** Object: Table [dbo].[Student_Classes] Script Date: 03/31/2008 01:32:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Student_Classes](
[StudClassID] [int] IDENTITY(0,1) NOT NULL,
[StudentID] [int] NULL,
[ClassID] [varchar](7) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CreditID] [int] NULL,
[Days] [varchar](6) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Time] [varchar](30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Classroom] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Grade] [varchar](3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Semester] [varchar](40) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Notes] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Completed] [tinyint] NULL CONSTRAINT [DF_Student_Classes_Completed] DEFAULT ((0)),
CONSTRAINT [PK_Student_Classes] PRIMARY KEY CLUSTERED
(
[StudClassID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[Student_Classes] WITH CHECK ADD CONSTRAINT [FK_Student_Classes_ClassID] FOREIGN KEY([ClassID])
REFERENCES [dbo].[Classes] ([ClassID])
GO
ALTER TABLE [dbo].[Student_Classes] CHECK CONSTRAINT [FK_Student_Classes_ClassID]
GO
ALTER TABLE [dbo].[Student_Classes] WITH CHECK ADD CONSTRAINT [FK_Student_Classes_CreditID] FOREIGN KEY([CreditID])
REFERENCES [dbo].[Credits] ([CreditID])
GO
ALTER TABLE [dbo].[Student_Classes] CHECK CONSTRAINT [FK_Student_Classes_CreditID]
GO
ALTER TABLE [dbo].[Student_Classes] WITH CHECK ADD CONSTRAINT [FK_Student_Classes_StudentsID] FOREIGN KEY([StudentID])
REFERENCES [dbo].[Students] ([StudentID])
GO
ALTER TABLE [dbo].[Student_Classes] CHECK CONSTRAINT [FK_Student_Classes_StudentsID]
USE [C:PROGRAM FILESMICROSOFT SQL SERVERMSSQL.1MSSQLDATACOLLEGE.MDF]
GO
/****** Object: Table [dbo].[Prerequisites] Script Date: 03/31/2008 01:32:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Prerequisites](
[PrerequisiteID] [varchar](7) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[ClassID] [varchar](7) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
CONSTRAINT [PK_Prerequisite] PRIMARY KEY CLUSTERED
(
[PrerequisiteID] ASC,
[ClassID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[Prerequisites] WITH CHECK ADD CONSTRAINT [FK_Prerequisite_ClassID] FOREIGN KEY([ClassID])
REFERENCES [dbo].[Classes] ([ClassID])
GO
ALTER TABLE [dbo].[Prerequisites] CHECK CONSTRAINT [FK_Prerequisite_ClassID]
GO
ALTER TABLE [dbo].[Prerequisites] WITH CHECK ADD CONSTRAINT [FK_Prerequisite_Prereq] FOREIGN KEY([PrerequisiteID])
REFERENCES [dbo].[Classes] ([ClassID])
GO
ALTER TABLE [dbo].[Prerequisites] CHECK CONSTRAINT [FK_Prerequisite_Prereq]
USE [C:PROGRAM FILESMICROSOFT SQL SERVERMSSQL.1MSSQLDATACOLLEGE.MDF]
GO
/****** Object: Table [dbo].[Credits] Script Date: 03/31/2008 01:32:43 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Credits](
[CreditID] [int] IDENTITY(0,1) NOT NULL,
[ClassID] [varchar](7) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Credits] [tinyint] NULL,
CONSTRAINT [PK_Credits] PRIMARY KEY CLUSTERED
(
[CreditID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[Credits] WITH CHECK ADD CONSTRAINT [FK_Credits_ClassID] FOREIGN KEY([ClassID])
REFERENCES [dbo].[Classes] ([ClassID])
GO
ALTER TABLE [dbo].[Credits] CHECK CONSTRAINT [FK_Credits_ClassID]
SELECT sClass.StudClassID
,sClass.Completed
,sClass.ClassID AS 'Class ID'
,c.LongName AS 'Name'
,c.Description
,cred.Credits
,(SELECT COALESCE(@prerequisites + ', ', '') + CAST(PrerequisiteID AS varchar(7))) AS 'Prerequisites'
,sClass.Grade
,sClass.Days
,sClass.Time
,sClass.Classroom
,sClass.Semester
,sClass.Notes
FROM Student_Classes sClass
INNER JOIN Prerequisites preq
ON preq.ClassID = sClass.ClassID
INNER JOIN Classes c
ON c.ClassID = sClass.ClassID
INNER JOIN Credits cred
ON cred.CreditID = sClass.CreditID
WHERE sClass.StudentID = 0
ORDER BY sClass.ClassID ASC
View 5 Replies
View Related
Jul 24, 2004
Hello,
We are creating an app to search through products. On the presentation layer, we allow a user to 'select' categories (up to 10 check boxes). When we get the selected check boxes, we create a concatenated string with the values.
My question is: when I pass the concatenated string to the SPROC, how would I write a select statement that would search through the category field, and find the values in the concatenated string?
Will I have to create Dynamic SQL to do this?...or... can I do something like this...
@ConcatenatedString --eg. 1,2,3,4,5,6,7
SELECT col1, col2, col3 FROM TABLE WHERE CategoryId LIKE @ConcatenatedString
Thanks for your help.
View 2 Replies
View Related
Aug 10, 2000
I have:
<<Select @SQL = 'Select Keyword, SICCode From zlk_SICCodeKeyword Where Keyword like ''%' + @KeywordOrSIC + '%''' + ' order by Keyword'
exec(@SQL)>>
which works fine, but I want to modify it to do this
<<Select Replace(Keyword,',',' ') AS Keyword, SICCode From zlk_SICCodeKeyword Where Keyword like 'real%' order by Keyword >>
which works from the query window but I can not get the right combination around the 'replace section' to make up a string for the exec.
All help greatly appreciated
Judith
View 1 Replies
View Related
Jun 20, 2008
I have a table with multiple rows for a single reference, e.g.
Col1 Col2
1 John
1 Mary
1 Tom
2 Dick
2 Anne
How do I create this view:
Col1 Col2
1 John, Mary, Tom
2 Dick, Anne
View 5 Replies
View Related
Nov 22, 2007
When I set a column to have a default definition that uses a UDF, I am receiving the "String or binary data would be truncated" error.
The UDF:
Code BlockALTER FUNCTION GetDefaultClientTier
(
@ClientAssets decimal(15,2)
)
RETURNS char(1)
AS
BEGIN
DECLARE @Result char(1)
-- Get the first result in case of overlaps.
SET @Result = CAST((SELECT TOP 1 ClientTier FROM ClientTiers WHERE @ClientAssets BETWEEN ClientAssetsFloor AND ClientAssetsCeiling) AS char(1))
RETURN @Result
END
ClientTier is defined as char(1) in the table. I simply have (isnull([dbo].[GetDefaultClientTier]([ClientAssets])),(null))) as the definition. I can't use a computed column because I the values need to be editable. When inserting with SSIS, the insert works fine but the column has a value of null for each row.
When putting a character as the default (like 'A') the insert works fine.
The cast is there only because I have tried everything I can think of to get around this.
Is there something simple I am overlooking?
(SQL2005 SP2)
Thanks!
View 3 Replies
View Related
Oct 17, 2007
SQL Server 2005.(SP2). MS SSRS;
I want to display some numbers in the same line as a concatenated string. For example a Customer may have multiple bills. These bill numbers are displayed in separate rows. I want to display them all on the same line.
Example of current display:
Customer Bill #
ABC Company 123
ABC Company 456
ABC Company 789 etc
I want this to display as below:
Cusotmer Bill #
ABC Company 123, 456, 789, etc.
Is this possible in SSRS. Please help me with the syntax.
Thanks in advance.
View 2 Replies
View Related
Nov 8, 2007
Hi,
I have a stored proc which accepts a varchar(255) as a parameter and when I call the proc using a concatenised string I get an error i.e.
-- Proc
CREATE PROCEDURE #proc_param_test
@p_param1 varchar(40) = NULL
, @p_param2 varchar(40) = NULL
AS
BEGIN
SELECT @p_param1, @p_param2
END
EXEC #proc_param_test 'test', 'test 2'
returns
---------------------------------------- ----------------------------------------
test test 2
but EXEC #proc_param_test 'test', 'test 2' + ' - the rest'
gives a Incorrect syntax near '+'. error
The solution must be a real doddle but it's a 'mare to find anywhere.
Cheers,
John
View 4 Replies
View Related
Nov 21, 2006
I have following 2 queries which return different results.
declare @accountIdListTemp varchar(max)
SELECT COALESCE(@accountIdListTemp + ',','') + CONVERT(VARCHAR(10),acct_id)
FROM (SELECT Distinct acct_id
FROM SomeTable) Result
print @accountIdListTemp
The above query return the values without concatenating it.
declare @pot_commaSeperatedList varchar(max)
SELECT DISTINCT acct_id
into #accountIdListTemp
FROM SomeTable
SELECT @pot_commaSeperatedList = COALESCE(@pot_commaSeperatedList + ',','') + CONVERT(VARCHAR(100),acct_id)
FROM #accountIdListTemp
print @pot_commaSeperatedList
drop table #accountIdListTemp
This query returns result as concatenated string of comma separated values.
If i want to get similar result in a single query how can i get it?
View 4 Replies
View Related
Jun 13, 2012
I have a table where one column is an id card number (col1) and another is another column (col2). In col2 I have various values for each col1 ie col1 can have various values of col2. How can i insert col1 concatenated for each col1 in another table?
View 2 Replies
View Related
Mar 7, 2008
Hi folks,I have an issue with a column I created in my query called Instance.SELECT Object_Id, Event_type, Audience, Subject, Provider, Academic_Year, Start_date, End_date, CONVERT(varchar, Academic_Year) + ' (' + CONVERT(varchar, Start_date, 103) + ') : ' + Event_type AS InstanceFROM EventsORDER BY Event_type Above is my query. The problem is because the start date column can be null, it also returns the Instance column as null for that row.I thought it would have just missed out the date and display the rest, but it doesn't.Is there any way I could get the Instance column to display a value, when the start date is null?ThanksEdit: Managed to sort it using ISNULL()
View 14 Replies
View Related
Jan 13, 2015
I have a very interesting problem in T-SQL coding for which I can't figure out the solution. Actually there is a Line_1_Address column in our data warehouse address table which is being populated from various sources. Some sources have already concatenated house number + street address fields in the Line_1_Address column whereas one source has separated columns for both data fields.
Now I'm trying to extract data from this data warehouse table and I need to split the house number from street address and load it into separate columns in my destination table. In case there is no data for house number then I should load it as NULL.
The issue is that data in this Line_1_Address column is very inconsistent so I don't know which functions to use. Here is some sample data for your consideration:
Line_1_Address
101 E Commerce ST
120 E Commerce ST
2 Po Box
301 W. Bel Air Ave
West Main Street, PO Box 1388
[Code] .....
View 6 Replies
View Related
Feb 2, 2006
I have the following to create a new table....
CREATE TABLE dbo.test (Id varchar(20) NOT NULL PRIMARY KEY, Name varchar(256) NOT NULL, visible bit NOT NULL )
I need to set the default value of the bit visible to 1.
How can this be done using a T-SQL statement?
Thanks,
Zath
View 1 Replies
View Related
Jul 15, 2002
Hi all:
How can I change the Default value of a column in a table using sql?
for instance I have a table called Phone and I have a field called AreaCode and the default now is '123' . I would like to change it to '456'.
Thanks,
Nisha
View 1 Replies
View Related
Jan 8, 2007
hi
i have to add a column of date datatype and i want to set the default value to getdate(). how to do this using sql script.
thanks
suji
View 1 Replies
View Related
Mar 19, 2004
This isn't really DB related, except for the connection, but I was wondering if any of you guys had run into this before.
I have a ODBC System DSN Setup for a connection to my MSSQL2K Server. My users will occasionally lose the Default Database setting (Drop-down during DSN Setup), forcing me to go in and reset it. It's getting to be a pain in the ass and I was wonder if any of you guys had run into this before.
Thanks!
Ed
View 1 Replies
View Related
Mar 18, 2015
Is there any practical downside to setting ANSI_NULLS and QUOTED_IDENTIFIER to ON at the database level? Almost all devs will simply leave these default settings at the top of a stored proc script anyway.
View 2 Replies
View Related
Jun 6, 2006
Pardon the newbie question...but I'm trying to load a dimension table in a small data mart that has columns in it that are unique to the dimension and not sourced from any source table. Two of those columns are date columns that I want to default to the system date and the other column I want to load with a default value. I can't figure out how to do this within a data flow task. The source columns flow from the input db source into a scd transform but I can't seem to edit the columns in the target table table if they don't actually come from a data source. There doesn't seem to be a data transform object to handle this.
Thanks.
View 5 Replies
View Related
May 16, 2008
Hi,
I have few question:
1)Is it any methot to modify lock_timeout default value? (Default value is -1, if i want to modify default value for example 1, i try [SET lock_timeout 1;] but it only work during that session / connection)
2)Is it any method to modifyTransaction Isolation Level default value? (Default value is READ COMMITTED, if i want to modify default value for example READ UNCOMMITTED, I try [SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;], but it only work during that session / connection)
Thank you!~
View 2 Replies
View Related
May 22, 2007
I have created an employee directory that displays a picture from a folder based on a consistent naming scheme. I need to set a default value for the picture for when a photo by that name does not exist in the folder. I've tried using both the ISNULL and ISNOTHING commands. Does anyone know how to do this?
View 1 Replies
View Related
Nov 4, 2005
How can I restore the default setting for MSDE to have only Windows
Autentication and not mixed mode? And to have my sa account without
password? Please help me! Thanks, Nibbles
View 1 Replies
View Related
Apr 23, 2006
is there any way I can setup the default transactional level at the Database level instead.
Such as I don't want to write the transaction isolation level at every SQL statement.
View 2 Replies
View Related
Mar 14, 2008
Hi All.,
here i try to set default value 0 while creating table., But in my code its not working.,any one please help me to know how to set a default value while creating table.,
here is the sample code.,
CREATE TABLE MODULE_ROLE
(
MODULE_ROLE_IDINT IDENTITY(1,1) NOT NULL,
ADD_FLAGBIT default 0,
UPDATE_FLAGBIT default 0,
BIT default 0,
VIEW_FLAGBIT default 0,
INPUT_USERINT
)
insert into MODULE_ROLE values (null,null,1,null,1)
select * from module_role
----------------------------------------------------------------------
MODULE_ROLE_ID ADD_FLAG UPDATE_FLAG DELETE_FLAG VIEW_FLAG INPUT_USER
-------------- -------- ----------- ----------- --------- -----------
1 NULL NULL 1 NULL 1
BUT I NEED 0 FOR NULL VALUES..,
View 1 Replies
View Related
Aug 31, 2007
Hi,
I am having 2 tables Groups and GroupMembers table . the following are the structures for the above two tables
Group
---------
GroupID
GroupName
CashassignmentType
Groupmembers
----------------------
MemberID
memberName
GroupID
Payment
Group table is referenced by groupmembers table through Group ID Column
Here while i am inserting a row (member) into a Groupmembers tables i want to crosscheck with CashAssinmenttype column of Group table. if cashassignment type i want to set the payment with 0 other wise the payment specified should be inserted
Groupmembers.Payment <---> If Group.CashassignmentType=0
Then 0
Else Payment
I want to set this Condition while creating tables itself
Please let me know what could be the best option to proceed here
Thank you
View 1 Replies
View Related
Nov 28, 2007
I've been reading some forums and I'm not able to get this to work. Basically I'm using an Oracle DB source and trying to import data into SQL server 2005. I guess the best connections to use are OLE DB.
Here are my current connections:
Source: Native OLE DBOracle Provide for OLE DB
Destination: Native OLE DBSQL Native Client
I'm running SP2 of SQL 2005.
Now, the issue is I'm not getting the code page stuff correct. In the data flow I'm just doing a OLE DB Source to SQl Server Destination. I'm not doing any transformations (I'm hoping to avoid doing that).
I'm getting an error:
[OLE DB Source [1]] Warning: Cannot retrieve the column code page info from the OLE DB provider. If the component supports the "DefaultCodePage" property, the code page from that property will be used. Change the value of the property if the current string code page values are incorrect. If the component does not support the property, the code page from the component's locale ID will be used.
I'm looking at how to set the DefaultCodePage property in various forums, but nowhere does it say exactly how to do this. I've tried changing the "Extended Properties" and added AlwaysUseDefaultCodePage=TRUE in there, but that doesn't work. I've tried changing the Locale Identifier to 1252 that doesn't work. I've tried a combination of the two, doesn't work. Can somebody tell me two things:
1. what's the best/fastest/industry used method to get data from Oracle into SQL server via SSIS (please include the type of connections).
2. How the hell do you set the DefaultCodePage property. I would love a screenshot on this one as well.
Thanks,
Phil
View 3 Replies
View Related
May 30, 2006
Hi,
I have been trying to configure the Paper Size to be default "A4" instead of "Letter".
My Report is configured to 21cm x 29,7cm and margins 1,5cm.
The Body is configured to 18cm x 26,7cm.
Everything looks fine in the Preview but the Size is always "Letter". The printers are all configured for A4 printing.
Is there a way to set these default values in the Page Setup Toolbar or is it supposed to figure it out?
Thanks,
steinar
View 4 Replies
View Related
Feb 5, 2007
Hi
I have a database details veiw on my vb 2005 express form.
When I run my program , all the data in row 1 automatically shows up, as the default.
How can I set the default to show the data from row 2 when I start up my program?
Thanks
Rob
View 2 Replies
View Related
Oct 29, 2015
how to achieve the below mentioned in SSAS: P
1 - Set Default values 20 and 80
2 -Set Default value <> 90 or except 90.
View 2 Replies
View Related
Jan 21, 2007
I thought this would be easy. I have a repeater control and a sqldatasource control. I am trying to filter the select statement using DateTime.Now.ToString() and keep getting an invalid date string format. The control is on a content page in my asp.net site. On the master page this <%= DateTime.Now.ToLongDateString() %> works to display the current date. If I try and put <%= DateTime.Now.ToString() %> in the Default value of the SelectParameter it does not work. No intellisense either so I am assuming I am missing something. Here is the code... pretty basic really.
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="sqlDSnews">
<ItemTemplate>
<h3><%# Eval("newTitle")%></h3>
</ItemTemplate>
</asp:Repeater>
<asp:SqlDataSource
ID="sqlDSnews"
runat="server"
ConnectionString="<%$ ConnectionStrings:XXXX%>"
SelectCommand="SELECT [newTitle], [newsDetails], [dateExpires], [newsImage], [dateCreated] FROM [News] WHERE (([GroupID] = @GroupID) AND ([dateExpires] >= @dateExpires))">
<SelectParameters>
<asp:QueryStringParameter DefaultValue="0" Name="GroupID" QueryStringField="Gid" Type="Int32" />
<asp:Parameter Name="dateExpires" DefaultValue='<%= DateTime.Now.ToString() %> 'Type="DateTime" />
</SelectParameters>
</asp:SqlDataSource>
** NOTE the DateTime does not show up in blue - if that helps with a solution **
View 5 Replies
View Related
Apr 10, 2006
Hi,I have a column (type: datetime) in which I want to load the current date and time.What should I fill in in the default value or binding so that SQL server automatically fills this column?Thanks!
View 2 Replies
View Related