Showing posts with label store. Show all posts
Showing posts with label store. Show all posts

Wednesday, March 28, 2012

How to get the system date and time into database

Hi,

I m using ASP.NET with C#.
I m having one field which should store the datetime of the system.

The datetime should be automatically stored for that entry when the user submits that record on the click event.
Then it should display the date time on the gridview from database.

I m using sqlserver 2005 and i have created the stored procedure for the insert command.

Thisis the sample sp what should be written here to insert system date timeautomatically when the user submits the asp.net form ?

Is there any code for writing directly in stored procedure or asp.net coding page...


ALTER PROCEDURE [dbo].[StoredProcedure1]

@.salesid INT OUTPUT,
@.salesdate datetime,
@.customername varchar(20)

AS
BEGIN
SET NOCOUNT ON

BEGIN
INSERT INTO sales (customername)
VALUES (@.customername)
SELECT @.companyid = SCOPE_IDENTITY()
END

SET NOCOUNT OFF
END

 
Thanxs in advance...

Hi,

use getdate() function of sql server.

for more info look here

http://msdn2.microsoft.com/en-us/library/ms188383.aspx

|||

You have a choice as to where to use the getdate() function (which returns the current system date and time).

You can actually define it on a column in the table itself so that you don't have to set it programmatically. Here is sample syntax:

create table sales (sales_id int identity, customer_name varchar(30) not null,sales_date datetime default getdate() not null)

Alternatively, within the stored procedure assign your variable with the function call. Here is sample syntax:

select @.SystemDate = getdate()

How to Get the SQL Affinity Mask value in Sql 2005, and table that store this info

Hi All

Can u pls tell me How to Get the SQL Affinity Mask value in Sql 2005.

and what is the table/views name that store this info.

for SQL 2000 , we were using following query:

SQLStatement.printf("select c.value from master..sysconfigures c, master..spt_values v,"
"master..syscurconfigs r where v.type = 'C' and v.number = c.config and v.number >= 0 "
"and v.number = r.config and v.name ='affinity mask'");

lErrCode=SQLExecDirect(hStmt,(SQLCHAR*)pszSQLStatement,strlen(pszSQLStatement));

lSQLBindCol(nAffMask);

But With SQL 2005 , we are getting ZERO(0) ROWS SELECTED.

Is there any reason why you can't just exec sp_configure and look at the value for 'affinity mask'?
(you need 'show advanced options' to be turned on for it to show, though)

/Kenneth

Monday, March 26, 2012

How to get the password change date in SQL Server

I have searched this topic on google first, and I understood that "xdate2
column of sysxlogins" may store this info, but might not exclusively store
this info... this value changes as extra permissions is granted.
Is there a way to get the password change date? Either within a column of a
table, or programatically?
Thank you in advance.
/SMAC
Actually if you are using SQL Server 2005 you can use
select name,modify_date from sys.server_principals
However ,there is no guarantee that only password has been changed , could
be name as well
"SMAC" <info@.smactool.com> wrote in message
news:rVsQg.340$gE7.320@.newsfe05.lga...
>I have searched this topic on google first, and I understood that "xdate2
>column of sysxlogins" may store this info, but might not exclusively store
>this info... this value changes as extra permissions is granted.
> Is there a way to get the password change date? Either within a column of
> a table, or programatically?
> Thank you in advance.
> /
>|||Thank you Uri,
Any sure way to do this for all SQL 7, 2000, 2005?
Thanks,
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:uj94vFW3GHA.4648@.TK2MSFTNGP04.phx.gbl...
> SMAC
> Actually if you are using SQL Server 2005 you can use
> select name,modify_date from sys.server_principals
>
> However ,there is no guarantee that only password has been changed , could
> be name as well
>
>
>
> "SMAC" <info@.smactool.com> wrote in message
> news:rVsQg.340$gE7.320@.newsfe05.lga...
>|||Check out the syslogins table (view on 2005).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"SMAC" <info@.smactool.com> wrote in message news:j2wQg.5$v14.4@.newsfe02.lga...n">
> Thank you Uri,
> Any sure way to do this for all SQL 7, 2000, 2005?
> Thanks,
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:uj94vFW3GHA.4648@.TK2MSFTNGP04.phx.gbl...
>|||In 2005 there is loginproperties I can use, how about SQL 7 and 2000? Any
idea?
Thank you.
/
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:u9WqBDb3GHA.4560@.TK2MSFTNGP05.phx.gbl...[vbcol=seagreen]
> Check out the syslogins table (view on 2005).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "SMAC" <info@.smactool.com> wrote in message
> news:j2wQg.5$v14.4@.newsfe02.lga...|||No, that function doesn't exist in earlier versions. I'd go for syslogins on
pre-2005 and the
LOGINPROPERTY function on 2005 (version check in your code).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"SMAC" <info@.smactool.com> wrote in message news:rSIQg.73$c86.46@.newsfe07.lga...een">
> In 2005 there is loginproperties I can use, how about SQL 7 and 2000? Any
idea?
> Thank you.
> /
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote i
n message
> news:u9WqBDb3GHA.4560@.TK2MSFTNGP05.phx.gbl...
>|||Thanks Tibor,
syslogins doesn't give the reliable password modified date because any
changes to the logins will change the date within syslogins / sysxlogins...
Maybe I'll ask this question in a different way...
when CHECK_EXPIRATION property of the login is set to ON, how does SQL
Server check the password expiration? I believe there is a place where it
stores password creation date right?
Please share your insight.
Thanks!
/
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:elCVDFh3GHA.3492@.TK2MSFTNGP06.phx.gbl...
> No, that function doesn't exist in earlier versions. I'd go for syslogins
> on pre-2005 and the LOGINPROPERTY function on 2005 (version check in your
> code).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "SMAC" <info@.smactool.com> wrote in message
> news:rSIQg.73$c86.46@.newsfe07.lga...
>|||Most probably you cannot differentiate between password change and other log
in modifications in 2000
and earlier. So for those versions, syslogins is what you have.
As for 2005, where is the problem? Why not use the LOGINPROPERTY() function,
which you already found
and according to the documentation can answer when password was last changed
? Btw, it seems like the
information from that function comes from the same place as the modified_dat
e in sys.sql_logins (as
this doesn't change when I alter the default database for a login...).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"SMAC" <info@.smactool.com> wrote in message news:6dQQg.310$aF4.164@.newsfe06.lga...green">
> Thanks Tibor,
> syslogins doesn't give the reliable password modified date because any cha
nges to the logins will
> change the date within syslogins / sysxlogins...
> Maybe I'll ask this question in a different way...
> when CHECK_EXPIRATION property of the login is set to ON, how does SQL Ser
ver check the password
> expiration? I believe there is a place where it stores password creation
date right?
> Please share your insight.
> Thanks!
> /
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote i
n message
> news:elCVDFh3GHA.3492@.TK2MSFTNGP06.phx.gbl...
>|||I believe this is the field that you are looking for:
select xdate2 AS password_change_date,
DATEDIFF(dd, xdate2, GETDATE()) AS days_since_change
FROM master.dbo.sysxlogins
Tibor Karaszi wrote:[vbcol=seagreen]
> Most probably you cannot differentiate between password change and other l
ogin modifications in 2000
> and earlier. So for those versions, syslogins is what you have.
> As for 2005, where is the problem? Why not use the LOGINPROPERTY() functio
n, which you already found
> and according to the documentation can answer when password was last chang
ed? Btw, it seems like the
> information from that function comes from the same place as the modified_d
ate in sys.sql_logins (as
> this doesn't change when I alter the default database for a login...).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "SMAC" <info@.smactool.com> wrote in message news:6dQQg.310$aF4.164@.newsfe0
6.lga...sql

How to get the password change date in SQL Server

I have searched this topic on google first, and I understood that "xdate2
column of sysxlogins" may store this info, but might not exclusively store
this info... this value changes as extra permissions is granted.
Is there a way to get the password change date? Either within a column of a
table, or programatically?
Thank you in advance.
/
SMAC
Actually if you are using SQL Server 2005 you can use
select name,modify_date from sys.server_principals
However ,there is no guarantee that only password has been changed , could
be name as well
"SMAC" <info@.smactool.com> wrote in message
news:rVsQg.340$gE7.320@.newsfe05.lga...
>I have searched this topic on google first, and I understood that "xdate2
>column of sysxlogins" may store this info, but might not exclusively store
>this info... this value changes as extra permissions is granted.
> Is there a way to get the password change date? Either within a column of
> a table, or programatically?
> Thank you in advance.
> /
>
|||Thank you Uri,
Any sure way to do this for all SQL 7, 2000, 2005?
Thanks,
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:uj94vFW3GHA.4648@.TK2MSFTNGP04.phx.gbl...
> SMAC
> Actually if you are using SQL Server 2005 you can use
> select name,modify_date from sys.server_principals
>
> However ,there is no guarantee that only password has been changed , could
> be name as well
>
>
>
> "SMAC" <info@.smactool.com> wrote in message
> news:rVsQg.340$gE7.320@.newsfe05.lga...
>
|||Check out the syslogins table (view on 2005).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"SMAC" <info@.smactool.com> wrote in message news:j2wQg.5$v14.4@.newsfe02.lga...
> Thank you Uri,
> Any sure way to do this for all SQL 7, 2000, 2005?
> Thanks,
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:uj94vFW3GHA.4648@.TK2MSFTNGP04.phx.gbl...
>
|||In 2005 there is loginproperties I can use, how about SQL 7 and 2000? Any
idea?
Thank you.
/
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:u9WqBDb3GHA.4560@.TK2MSFTNGP05.phx.gbl...[vbcol=seagreen]
> Check out the syslogins table (view on 2005).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "SMAC" <info@.smactool.com> wrote in message
> news:j2wQg.5$v14.4@.newsfe02.lga...
|||No, that function doesn't exist in earlier versions. I'd go for syslogins on pre-2005 and the
LOGINPROPERTY function on 2005 (version check in your code).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"SMAC" <info@.smactool.com> wrote in message news:rSIQg.73$c86.46@.newsfe07.lga...
> In 2005 there is loginproperties I can use, how about SQL 7 and 2000? Any idea?
> Thank you.
> /
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message
> news:u9WqBDb3GHA.4560@.TK2MSFTNGP05.phx.gbl...
>
|||Thanks Tibor,
syslogins doesn't give the reliable password modified date because any
changes to the logins will change the date within syslogins / sysxlogins...
Maybe I'll ask this question in a different way...
when CHECK_EXPIRATION property of the login is set to ON, how does SQL
Server check the password expiration? I believe there is a place where it
stores password creation date right?
Please share your insight.
Thanks!
/
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:elCVDFh3GHA.3492@.TK2MSFTNGP06.phx.gbl...
> No, that function doesn't exist in earlier versions. I'd go for syslogins
> on pre-2005 and the LOGINPROPERTY function on 2005 (version check in your
> code).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "SMAC" <info@.smactool.com> wrote in message
> news:rSIQg.73$c86.46@.newsfe07.lga...
>
|||Most probably you cannot differentiate between password change and other login modifications in 2000
and earlier. So for those versions, syslogins is what you have.
As for 2005, where is the problem? Why not use the LOGINPROPERTY() function, which you already found
and according to the documentation can answer when password was last changed? Btw, it seems like the
information from that function comes from the same place as the modified_date in sys.sql_logins (as
this doesn't change when I alter the default database for a login...).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"SMAC" <info@.smactool.com> wrote in message news:6dQQg.310$aF4.164@.newsfe06.lga...
> Thanks Tibor,
> syslogins doesn't give the reliable password modified date because any changes to the logins will
> change the date within syslogins / sysxlogins...
> Maybe I'll ask this question in a different way...
> when CHECK_EXPIRATION property of the login is set to ON, how does SQL Server check the password
> expiration? I believe there is a place where it stores password creation date right?
> Please share your insight.
> Thanks!
> /
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message
> news:elCVDFh3GHA.3492@.TK2MSFTNGP06.phx.gbl...
>
|||I believe this is the field that you are looking for:
selectxdate2 AS password_change_date,
DATEDIFF(dd, xdate2, GETDATE()) AS days_since_change
FROMmaster.dbo.sysxlogins
Tibor Karaszi wrote:[vbcol=seagreen]
> Most probably you cannot differentiate between password change and other login modifications in 2000
> and earlier. So for those versions, syslogins is what you have.
> As for 2005, where is the problem? Why not use the LOGINPROPERTY() function, which you already found
> and according to the documentation can answer when password was last changed? Btw, it seems like the
> information from that function comes from the same place as the modified_date in sys.sql_logins (as
> this doesn't change when I alter the default database for a login...).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "SMAC" <info@.smactool.com> wrote in message news:6dQQg.310$aF4.164@.newsfe06.lga...

How to get the password change date in SQL Server

I have searched this topic on google first, and I understood that "xdate2
column of sysxlogins" may store this info, but might not exclusively store
this info... this value changes as extra permissions is granted.
Is there a way to get the password change date? Either within a column of a
table, or programatically?
Thank you in advance.
/SMAC
Actually if you are using SQL Server 2005 you can use
select name,modify_date from sys.server_principals
However ,there is no guarantee that only password has been changed , could
be name as well
"SMAC" <info@.smactool.com> wrote in message
news:rVsQg.340$gE7.320@.newsfe05.lga...
>I have searched this topic on google first, and I understood that "xdate2
>column of sysxlogins" may store this info, but might not exclusively store
>this info... this value changes as extra permissions is granted.
> Is there a way to get the password change date? Either within a column of
> a table, or programatically?
> Thank you in advance.
> /
>|||Thank you Uri,
Any sure way to do this for all SQL 7, 2000, 2005?
Thanks,
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:uj94vFW3GHA.4648@.TK2MSFTNGP04.phx.gbl...
> SMAC
> Actually if you are using SQL Server 2005 you can use
> select name,modify_date from sys.server_principals
>
> However ,there is no guarantee that only password has been changed , could
> be name as well
>
>
>
> "SMAC" <info@.smactool.com> wrote in message
> news:rVsQg.340$gE7.320@.newsfe05.lga...
>>I have searched this topic on google first, and I understood that "xdate2
>>column of sysxlogins" may store this info, but might not exclusively store
>>this info... this value changes as extra permissions is granted.
>> Is there a way to get the password change date? Either within a column
>> of a table, or programatically?
>> Thank you in advance.
>> /
>|||Check out the syslogins table (view on 2005).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"SMAC" <info@.smactool.com> wrote in message news:j2wQg.5$v14.4@.newsfe02.lga...
> Thank you Uri,
> Any sure way to do this for all SQL 7, 2000, 2005?
> Thanks,
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:uj94vFW3GHA.4648@.TK2MSFTNGP04.phx.gbl...
>> SMAC
>> Actually if you are using SQL Server 2005 you can use
>> select name,modify_date from sys.server_principals
>>
>> However ,there is no guarantee that only password has been changed , could
>> be name as well
>>
>>
>>
>> "SMAC" <info@.smactool.com> wrote in message
>> news:rVsQg.340$gE7.320@.newsfe05.lga...
>>I have searched this topic on google first, and I understood that "xdate2
>>column of sysxlogins" may store this info, but might not exclusively store
>>this info... this value changes as extra permissions is granted.
>> Is there a way to get the password change date? Either within a column
>> of a table, or programatically?
>> Thank you in advance.
>> /
>>
>|||In 2005 there is loginproperties I can use, how about SQL 7 and 2000? Any
idea?
Thank you.
/
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:u9WqBDb3GHA.4560@.TK2MSFTNGP05.phx.gbl...
> Check out the syslogins table (view on 2005).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "SMAC" <info@.smactool.com> wrote in message
> news:j2wQg.5$v14.4@.newsfe02.lga...
>> Thank you Uri,
>> Any sure way to do this for all SQL 7, 2000, 2005?
>> Thanks,
>>
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message
>> news:uj94vFW3GHA.4648@.TK2MSFTNGP04.phx.gbl...
>> SMAC
>> Actually if you are using SQL Server 2005 you can use
>> select name,modify_date from sys.server_principals
>>
>> However ,there is no guarantee that only password has been changed ,
>> could be name as well
>>
>>
>>
>> "SMAC" <info@.smactool.com> wrote in message
>> news:rVsQg.340$gE7.320@.newsfe05.lga...
>>I have searched this topic on google first, and I understood that
>>"xdate2 column of sysxlogins" may store this info, but might not
>>exclusively store this info... this value changes as extra permissions
>>is granted.
>> Is there a way to get the password change date? Either within a column
>> of a table, or programatically?
>> Thank you in advance.
>> /
>>
>>|||No, that function doesn't exist in earlier versions. I'd go for syslogins on pre-2005 and the
LOGINPROPERTY function on 2005 (version check in your code).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"SMAC" <info@.smactool.com> wrote in message news:rSIQg.73$c86.46@.newsfe07.lga...
> In 2005 there is loginproperties I can use, how about SQL 7 and 2000? Any idea?
> Thank you.
> /
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message
> news:u9WqBDb3GHA.4560@.TK2MSFTNGP05.phx.gbl...
>> Check out the syslogins table (view on 2005).
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>>
>> "SMAC" <info@.smactool.com> wrote in message news:j2wQg.5$v14.4@.newsfe02.lga...
>> Thank you Uri,
>> Any sure way to do this for all SQL 7, 2000, 2005?
>> Thanks,
>>
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message news:uj94vFW3GHA.4648@.TK2MSFTNGP04.phx.gbl...
>> SMAC
>> Actually if you are using SQL Server 2005 you can use
>> select name,modify_date from sys.server_principals
>>
>> However ,there is no guarantee that only password has been changed , could be name as well
>>
>>
>>
>> "SMAC" <info@.smactool.com> wrote in message news:rVsQg.340$gE7.320@.newsfe05.lga...
>>I have searched this topic on google first, and I understood that "xdate2 column of sysxlogins"
>>may store this info, but might not exclusively store this info... this value changes as extra
>>permissions is granted.
>> Is there a way to get the password change date? Either within a column of a table, or
>> programatically?
>> Thank you in advance.
>> /
>>
>>
>|||Thanks Tibor,
syslogins doesn't give the reliable password modified date because any
changes to the logins will change the date within syslogins / sysxlogins...
Maybe I'll ask this question in a different way...
when CHECK_EXPIRATION property of the login is set to ON, how does SQL
Server check the password expiration? I believe there is a place where it
stores password creation date right?
Please share your insight.
Thanks!
/
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:elCVDFh3GHA.3492@.TK2MSFTNGP06.phx.gbl...
> No, that function doesn't exist in earlier versions. I'd go for syslogins
> on pre-2005 and the LOGINPROPERTY function on 2005 (version check in your
> code).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "SMAC" <info@.smactool.com> wrote in message
> news:rSIQg.73$c86.46@.newsfe07.lga...
>> In 2005 there is loginproperties I can use, how about SQL 7 and 2000?
>> Any idea?
>> Thank you.
>> /
>> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote
>> in message news:u9WqBDb3GHA.4560@.TK2MSFTNGP05.phx.gbl...
>> Check out the syslogins table (view on 2005).
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>>
>> "SMAC" <info@.smactool.com> wrote in message
>> news:j2wQg.5$v14.4@.newsfe02.lga...
>> Thank you Uri,
>> Any sure way to do this for all SQL 7, 2000, 2005?
>> Thanks,
>>
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message
>> news:uj94vFW3GHA.4648@.TK2MSFTNGP04.phx.gbl...
>> SMAC
>> Actually if you are using SQL Server 2005 you can use
>> select name,modify_date from sys.server_principals
>>
>> However ,there is no guarantee that only password has been changed ,
>> could be name as well
>>
>>
>>
>> "SMAC" <info@.smactool.com> wrote in message
>> news:rVsQg.340$gE7.320@.newsfe05.lga...
>>I have searched this topic on google first, and I understood that
>>"xdate2 column of sysxlogins" may store this info, but might not
>>exclusively store this info... this value changes as extra permissions
>>is granted.
>> Is there a way to get the password change date? Either within a
>> column of a table, or programatically?
>> Thank you in advance.
>> /
>>
>>
>|||Most probably you cannot differentiate between password change and other login modifications in 2000
and earlier. So for those versions, syslogins is what you have.
As for 2005, where is the problem? Why not use the LOGINPROPERTY() function, which you already found
and according to the documentation can answer when password was last changed? Btw, it seems like the
information from that function comes from the same place as the modified_date in sys.sql_logins (as
this doesn't change when I alter the default database for a login...).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"SMAC" <info@.smactool.com> wrote in message news:6dQQg.310$aF4.164@.newsfe06.lga...
> Thanks Tibor,
> syslogins doesn't give the reliable password modified date because any changes to the logins will
> change the date within syslogins / sysxlogins...
> Maybe I'll ask this question in a different way...
> when CHECK_EXPIRATION property of the login is set to ON, how does SQL Server check the password
> expiration? I believe there is a place where it stores password creation date right?
> Please share your insight.
> Thanks!
> /
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message
> news:elCVDFh3GHA.3492@.TK2MSFTNGP06.phx.gbl...
>> No, that function doesn't exist in earlier versions. I'd go for syslogins on pre-2005 and the
>> LOGINPROPERTY function on 2005 (version check in your code).
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>>
>> "SMAC" <info@.smactool.com> wrote in message news:rSIQg.73$c86.46@.newsfe07.lga...
>> In 2005 there is loginproperties I can use, how about SQL 7 and 2000? Any idea?
>> Thank you.
>> /
>> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message
>> news:u9WqBDb3GHA.4560@.TK2MSFTNGP05.phx.gbl...
>> Check out the syslogins table (view on 2005).
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>>
>> "SMAC" <info@.smactool.com> wrote in message news:j2wQg.5$v14.4@.newsfe02.lga...
>> Thank you Uri,
>> Any sure way to do this for all SQL 7, 2000, 2005?
>> Thanks,
>>
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message news:uj94vFW3GHA.4648@.TK2MSFTNGP04.phx.gbl...
>> SMAC
>> Actually if you are using SQL Server 2005 you can use
>> select name,modify_date from sys.server_principals
>>
>> However ,there is no guarantee that only password has been changed , could be name as well
>>
>>
>>
>> "SMAC" <info@.smactool.com> wrote in message news:rVsQg.340$gE7.320@.newsfe05.lga...
>>>I have searched this topic on google first, and I understood that "xdate2 column of
>>>sysxlogins" may store this info, but might not exclusively store this info... this value
>>>changes as extra permissions is granted.
>>>
>>> Is there a way to get the password change date? Either within a column of a table, or
>>> programatically?
>>>
>>> Thank you in advance.
>>> /
>>>
>>
>>
>|||I believe this is the field that you are looking for:
select xdate2 AS password_change_date,
DATEDIFF(dd, xdate2, GETDATE()) AS days_since_change
FROM master.dbo.sysxlogins
Tibor Karaszi wrote:
> Most probably you cannot differentiate between password change and other login modifications in 2000
> and earlier. So for those versions, syslogins is what you have.
> As for 2005, where is the problem? Why not use the LOGINPROPERTY() function, which you already found
> and according to the documentation can answer when password was last changed? Btw, it seems like the
> information from that function comes from the same place as the modified_date in sys.sql_logins (as
> this doesn't change when I alter the default database for a login...).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "SMAC" <info@.smactool.com> wrote in message news:6dQQg.310$aF4.164@.newsfe06.lga...
> > Thanks Tibor,
> >
> > syslogins doesn't give the reliable password modified date because any changes to the logins will
> > change the date within syslogins / sysxlogins...
> >
> > Maybe I'll ask this question in a different way...
> > when CHECK_EXPIRATION property of the login is set to ON, how does SQL Server check the password
> > expiration? I believe there is a place where it stores password creation date right?
> >
> > Please share your insight.
> >
> > Thanks!
> > /
> >
> >
> >
> > "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message
> > news:elCVDFh3GHA.3492@.TK2MSFTNGP06.phx.gbl...
> >> No, that function doesn't exist in earlier versions. I'd go for syslogins on pre-2005 and the
> >> LOGINPROPERTY function on 2005 (version check in your code).
> >>
> >> --
> >> Tibor Karaszi, SQL Server MVP
> >> http://www.karaszi.com/sqlserver/default.asp
> >> http://www.solidqualitylearning.com/
> >>
> >>
> >> "SMAC" <info@.smactool.com> wrote in message news:rSIQg.73$c86.46@.newsfe07.lga...
> >> In 2005 there is loginproperties I can use, how about SQL 7 and 2000? Any idea?
> >>
> >> Thank you.
> >> /
> >>
> >> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message
> >> news:u9WqBDb3GHA.4560@.TK2MSFTNGP05.phx.gbl...
> >> Check out the syslogins table (view on 2005).
> >>
> >> --
> >> Tibor Karaszi, SQL Server MVP
> >> http://www.karaszi.com/sqlserver/default.asp
> >> http://www.solidqualitylearning.com/
> >>
> >>
> >> "SMAC" <info@.smactool.com> wrote in message news:j2wQg.5$v14.4@.newsfe02.lga...
> >> Thank you Uri,
> >>
> >> Any sure way to do this for all SQL 7, 2000, 2005?
> >>
> >> Thanks,
> >>
> >>
> >> "Uri Dimant" <urid@.iscar.co.il> wrote in message news:uj94vFW3GHA.4648@.TK2MSFTNGP04.phx.gbl...
> >> SMAC
> >> Actually if you are using SQL Server 2005 you can use
> >> select name,modify_date from sys.server_principals
> >>
> >>
> >>
> >> However ,there is no guarantee that only password has been changed , could be name as well
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> "SMAC" <info@.smactool.com> wrote in message news:rVsQg.340$gE7.320@.newsfe05.lga...
> >>>I have searched this topic on google first, and I understood that "xdate2 column of
> >>>sysxlogins" may store this info, but might not exclusively store this info... this value
> >>>changes as extra permissions is granted.
> >>>
> >>> Is there a way to get the password change date? Either within a column of a table, or
> >>> programatically?
> >>>
> >>> Thank you in advance.
> >>> /
> >>>
> >>
> >>
> >>
> >>
> >>
> >
> >

Friday, March 23, 2012

How to get the images files size?

Hi,
I want to retrive the images from SQL database and store into microsoft access database.
But only images file which is <than 500mb is allowed to retireve.How can i get the images files size if i just store the image file name into my sql database.(there is another folder to store images)

p@.ywen.You can use something like this:


// Create a reference to the image directory.
System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(strFileDirectory);
// Create an array representing the files in the current directory.
System.IO.FileInfo[] fi = di.GetFiles("*.jpg");

// then get file size
int fileSize = fi[0].Length;

|||Thanks for your reply, but one more question here.

After i create the array to store the images, then when i wan to get the files size
i need to loop until EOF right?|||No, you can just loop through the array using a standard for or a foreach.sql

Wednesday, March 21, 2012

How to get the database file into .bak file format using C#

Hi,

I want to retrive the values from the database 'northwind' and then i want to store the backup files in"D:/Sample/north_database.bak" format(local machine).

I retrive the database values in .txt,XML format. Now i want to take in .bak format.

give the Suitable solution for this.

Subashini.G

subashi

Check out this article and then download the zip file, to see a sample of the code you want

http://www.codersource.net/csharp_sqldmo_sqlserver.aspx

HTH

|||

Hi,

They Above Article is useful for me. But this coding isstored is database Queries in text(txt) format but i need thedatabase table values stored in .bak format.

Give the solution please

|||

subashini

Take 2

Try

http://www.csharphelp.com/archives2/archive345.html

I think this gets you what you need.

HTH

|||

Thank you Very Much. This coding is very useful for me.....Smile

Regards

Subashini

How to get the current User when using a general connection user

I have a VB.Net app and a SQL Server 2005 database. Users must login to use
the application, and I have an Employee table to store their details.
However, I use a common user ID to connect to the database (for reasons I
won't go into here).
My problem is, some of my triggers need to know who the current user is, and
of course I can't use the current connection information to get this as I
always get the common user ID.
Does anyone have a technique to solve this dilema? Maybe some way to set a
variable or something when I connect so that I can determine which user has
initiated the connection?You can use application roles to achieve that. Works something like this:
a) Every user has a Windows account using Windows Authentication
b) When they run the application you enable the application role
c) Inside the application's session you can look at what the username is,
including in triggers, using suser_sname()
Hope this helps,
Ben Nevarez, MCDBA, OCP
Database Administrator
"David" wrote:

> I have a VB.Net app and a SQL Server 2005 database. Users must login to us
e
> the application, and I have an Employee table to store their details.
> However, I use a common user ID to connect to the database (for reasons I
> won't go into here).
> My problem is, some of my triggers need to know who the current user is, a
nd
> of course I can't use the current connection information to get this as I
> always get the common user ID.
> Does anyone have a technique to solve this dilema? Maybe some way to set a
> variable or something when I connect so that I can determine which user ha
s
> initiated the connection?
>

How to get the current date in C# and how do I pass this date to SQL Server

I am writing a ASP.NET C# web application. I will need to store the date in one field in one of my tables. It appears that I need to use the datetime data type for the date in SQL Server 2005.

So I have a question

1.) How do I get today's date in C# and how should this be passed to SQL server?

you can get the current date directly in SQL using getdate()|||Doing it in C# will return you the client system date. Getting the current date in SQL will ensure all datetime recorded in your application are in sync. If you are using the date for some sort of comparison determine the sequence of event, using the date from the client might pose some timing issue. Unless what you want is really the client's local time, you should use the Server time.|||

brgdotnet:

I am writing a ASP.NET C# web application. I will need to store the date in one field in one of my tables. It appears that I need to use the datetime data type for the date in SQL Server 2005.

So I have a question

1.) How do I get today's date in C# and how should this be passed to SQL server?

to get current date in c# use DateTime.Now.ToString()......... there is also some different methods under Now... use what is appropriate for u .


if u r using a procedure it is easier.... say proc. name saveCurrentDate

String s=DateTime.Now.ToString();

String queryString="saveCurrentDate '"+s+"'"; //// or String queryString="insert int myTable(mydate) values ('"+s+"')";

hope it will hellped u


|||

Actually I am processing some records from a comma delimited .txt file. Each item seperated by a comma, will map to a field in a SQL Server database table.

The date is in the format: 20070423, that is YYMMDD

So I need to take the date value and then write it into SQL server. So this brings us to another question. Do I need to change this date format to comply with that of SQL server? If so what format does it need to be in? I need some specifics so if you could even produce a code sample for C#, that would be great.

|||You can pass in the date in format YYYYMMDD as a string. SQL Server will implicitly convert it to string. As long as you are using Universal format YYYYMMDD, it is fine. Other format like MMDDYYYY or DDMMYYYY will be depending on the language setting that you used. So stick to YYYYMMDD and you will not go wrong.|||

I am confused about one thing though? I am reading from a text file where the format is in YYMMDD. Should I store this in SQL server as a data type of datetime or smalldatetime?

If so, I definitely have a date that, I can read from the text file, but I don't have a time? What do you think? If I did use datetime, would it just append the current time to the date I entered?

|||

you should always use proper data type for the data. In this case, you should use datetime or smalldatetime to store the date.

"I can read from the text file, but I don't have a time?"
You can still use datetime data type. Just set the time to 00:00:00. For your case, as your date string is in YYYYMMDD format without time, when you insert into table, the time will be stored as 00:00:00

Wednesday, March 7, 2012

How to get only date component from a datetime column

Hi all,

I have a table containing a datetime column and it stores date with time ( I use GETDATE() to store the value ). For reporting purpose I need only the date component from this column without the time component. I do not want to use the datepart(yyyy, orderdt), datepart(mm, orderdt) and datepart(dd, orderdt).

Will following help

select CONVERT ( VARCHAR (10) , GetDATE(), 121 )

Friday, February 24, 2012

how to get latest record from a table?

hi guys.
i have a table that store all transactions. In this table, a member can has multiple records, there is a field to store the date.
1. the problem i'm facing is, i need to retrieve only the latest record. for example, the transaction table contains of 20 records for 5 members, i need to retrieve the latest record for 5 members.
2. another problem that i face is, how can i make comparison with the date. let say i want to retrieve the record that more than 90 days?

thanks for all advises.

Engloon:

For #1 you need to make sure that you have an index on "member id" so that you can efficiently retrieve records based on the "member id."

For #2 you need to have an index baded on the date and you need to make sure that your field is has a "datetime" datatype.

declare @.member table
( memberId integer,
tranDT datetime
)
insert into @.member
select 5, '1/9/6' union all
select 5, '5/8/6' union all
select 5, '12/15/6' union all
select 5, '3/12/7'
--select * from @.member

/*
memberId tranDT
-- --
5 2006-01-09 00:00:00.000
5 2006-05-08 00:00:00.000
5 2006-12-15 00:00:00.000
5 2006-03-12 00:00:00.000
*/

select top 1
memberId,
tranDt
from @.member
order by tranDt desc

/*
memberId tranDt
-- --
5 2006-12-15 00:00:00.000
*/

select memberId,
tranDt
from @.member
where tranDt < getdate() - 90
order by tranDt desc

/*
memberId tranDt
--
5 2006-12-15 00:00:00.000
5 2006-05-08 00:00:00.000
5 2006-01-09 00:00:00.000
*/

|||

1. This should give you an idea about how to get the latest entry for each member. (I assume you have a MemberID column.)

Code Snippet


SELECT
MemberID,
max( TransactionDate )
FROM MyTable
GROUP BY MemberID
ORDER BY MemberID

2. Add a WHERE clause, something like this:

Code Snippet

WHERE TransactionDate < ( dateadd( day, -90, getdate() ))

|||many thanks to Arnie Rowland and Kent Waldrop. I appreciate your help.
but the @.member table contains not only 1 member. I'm thinking to use distinct function to get only 1 record for each member.
Will let you know if I can solve the problem.

|||here is the result of my sql query
MembershipID Date
3 03-Jan-2007
8 05-Aug-2006
8 18-Sep-2005
8 18-Sep-2005
187 16-May-2006
187 14-May-2006
187 06-Jun-2006
187 29-Jul-2005
187 05-Jan-2007
195 14-Mar-2006
239 29-Aug-2005
275 07-Aug-2005
303 28-Dec-2005
303 19-Dec-2006
306 03-Oct-2005
306 16-Dec-2005

the result that i desire would be like this
MembershipID Date
3 03-Jan-2007
8 05-Aug-2006
187 16-May-2006
195 14-Mar-2006
239 29-Aug-2005
275 07-Aug-2005
303 28-Dec-2005
306 03-Oct-2005
|||

Use the following query...

Code Snippet

Select Identity(Int,1,1) as UID,Id,Date Into #Temp from Members;

Select Mem.Id,Mem.Date From #Temp Mem
Join (Select Min(UId) UID,Id from #Temp Group By Id) as LastRec On LastRec.UID = Mem.UID;

Drop Table #Temp;

|||

Strange, it 'sounds' like you are 'blowing off' the solution that I provided. Too bad, because using the data you posted, and the query I provided, the exact resultset you asked for is produced.

Code Snippet


DECLARE @.MyTable table
( MembershipID int,
TransactionDate datetime
)


SET NOCOUNT ON


INSERT INTO @.MyTable VALUES ( 3, '03-Jan-2007' )
INSERT INTO @.MyTable VALUES ( 8, '05-Aug-2006' )
INSERT INTO @.MyTable VALUES ( 8, '18-Sep-2005' )
INSERT INTO @.MyTable VALUES ( 8, '18-Sep-2005' )
INSERT INTO @.MyTable VALUES ( 187, '16-May-2006' )
INSERT INTO @.MyTable VALUES ( 187, '14-May-2006' )
INSERT INTO @.MyTable VALUES ( 187, '06-Jun-2006' )
INSERT INTO @.MyTable VALUES ( 187, '29-Jul-2005' )
INSERT INTO @.MyTable VALUES ( 187, '05-Jan-2007' )
INSERT INTO @.MyTable VALUES ( 195, '14-Mar-2006' )
INSERT INTO @.MyTable VALUES ( 239, '29-Aug-2005' )
INSERT INTO @.MyTable VALUES ( 275, '07-Aug-2005' )
INSERT INTO @.MyTable VALUES ( 303, '28-Dec-2005' )
INSERT INTO @.MyTable VALUES ( 303, '19-Dec-2006' )
INSERT INTO @.MyTable VALUES ( 306, '03-Oct-2005' )
INSERT INTO @.MyTable VALUES ( 306, '16-Dec-2005' )


SELECT
MembershipID,
TransactionDate = max( TransactionDate )
FROM @.MyTable
GROUP BY MembershipID
ORDER BY MembershipID


MembershipID TransactionDate
3 2007-01-03 00:00:00.000
8 2006-08-05 00:00:00.000
187 2007-01-05 00:00:00.000
195 2006-03-14 00:00:00.000
239 2005-08-29 00:00:00.000
275 2005-08-07 00:00:00.000
303 2006-12-19 00:00:00.000
306 2005-12-16 00:00:00.000

|||

But your query doesn't give the last row, it gives the max tran date. He wants the row with the max tran date:

Code Snippet

DECLARE @.MyTable table
( MembershipID int,
Date datetime,
someOtherColumn int default (100),
yetAnotherColumn int default (100)
)


SET NOCOUNT ON


INSERT INTO @.MyTable (MembershipId, Date) VALUES ( 3, '03-Jan-2007' )
INSERT INTO @.MyTable (MembershipId, Date) VALUES ( 8, '05-Aug-2006' )
INSERT INTO @.MyTable (MembershipId, Date) VALUES ( 8, '18-Sep-2005' )
INSERT INTO @.MyTable (MembershipId, Date) VALUES ( 8, '18-Sep-2005' )
INSERT INTO @.MyTable (MembershipId, Date) VALUES ( 187, '16-May-2006' )
INSERT INTO @.MyTable (MembershipId, Date) VALUES ( 187, '14-May-2006' )
INSERT INTO @.MyTable (MembershipId, Date) VALUES ( 187, '06-Jun-2006' )
INSERT INTO @.MyTable (MembershipId, Date) VALUES ( 187, '29-Jul-2005' )
INSERT INTO @.MyTable (MembershipId, Date) VALUES ( 187, '05-Jan-2007' )
INSERT INTO @.MyTable (MembershipId, Date) VALUES ( 195, '14-Mar-2006' )
INSERT INTO @.MyTable (MembershipId, Date) VALUES ( 239, '29-Aug-2005' )
INSERT INTO @.MyTable (MembershipId, Date) VALUES ( 275, '07-Aug-2005' )
INSERT INTO @.MyTable (MembershipId, Date) VALUES ( 303, '28-Dec-2005' )
INSERT INTO @.MyTable (MembershipId, Date) VALUES ( 303, '19-Dec-2006' )
INSERT INTO @.MyTable (MembershipId, Date) VALUES ( 306, '03-Oct-2005' )
INSERT INTO @.MyTable (MembershipId, Date) VALUES ( 306, '16-Dec-2005' )

select membershipId, date, someOtherColumn, yetAnotherColumn
from (select membershipId, date, someOtherColumn, yetAnotherColumn,
row_number() over (partition by membershipId order by date desc) as rowNum
from @.MyTable) as myTable
where rowNum = 1


|||

You are right Louis -but in defense, I was working with the data he provided, assuming that we were working with the 'first step'. (It's so much easier when folks provide us with an adequate explanition and sample data...)

The query that I provided should be used as a derived table and then would provide the requested data -and it works in both SQL 2000 and SQL 2005.

(However, there is one significant issue -how to deal with duplicate MembershipID/Date records -and of course, your proposed solution has that same problem).

Code Snippet


DECLARE @.MyTable table
( MembershipID int,
[Date] datetime,
MyOtherColumn int
)


SET NOCOUNT ON


INSERT INTO @.MyTable VALUES ( 3, '03-Jan-2007', 1 )
INSERT INTO @.MyTable VALUES ( 8, '05-Aug-2006', 2 )
INSERT INTO @.MyTable VALUES ( 8, '18-Sep-2005', 3 )
INSERT INTO @.MyTable VALUES ( 8, '18-Sep-2005', 4 )
INSERT INTO @.MyTable VALUES ( 187, '16-May-2006', 5 )
INSERT INTO @.MyTable VALUES ( 187, '14-May-2006', 6 )
INSERT INTO @.MyTable VALUES ( 187, '06-Jun-2006', 7 )
INSERT INTO @.MyTable VALUES ( 187, '29-Jul-2005', 8 )
INSERT INTO @.MyTable VALUES ( 187, '05-Jan-2007', 9 )
INSERT INTO @.MyTable VALUES ( 195, '14-Mar-2006', 10 )
INSERT INTO @.MyTable VALUES ( 239, '29-Aug-2005', 11 )
INSERT INTO @.MyTable VALUES ( 275, '07-Aug-2005', 12 )
INSERT INTO @.MyTable VALUES ( 303, '28-Dec-2005', 13 )
INSERT INTO @.MyTable VALUES ( 303, '19-Dec-2006', 14 )
INSERT INTO @.MyTable VALUES ( 306, '03-Oct-2005', 15 )
INSERT INTO @.MyTable VALUES ( 306, '16-Dec-2005', 17 )


SELECT
t.MembershipID,
t.[Date],
t.MyOtherColumn
FROM @.MyTable t
JOIN ( SELECT
MembershipID,
[Date] = max( [Date] )
FROM @.MyTable
GROUP BY MembershipID
) dt
ON ( t.MembershipID = dt.MembershipID
AND t.[Date] = dt.[Date]
)
ORDER BY t.MembershipID

MembershipID Date MyOtherColumn
-
3 2007-01-03 00:00:00.000 1
8 2006-08-05 00:00:00.000 2
187 2007-01-05 00:00:00.000 9
195 2006-03-14 00:00:00.000 10
239 2005-08-29 00:00:00.000 11
275 2005-08-07 00:00:00.000 12
303 2006-12-19 00:00:00.000 14
306 2005-12-16 00:00:00.000 17

|||i'm so sorry, i should give an example of the result i need in the begining.
and many thanks to Arnie and all programmers who tried to help me.
i really appreciate it.

How to get last record ?

Dear all,
I am writing a store procedure which should return the last entry whcih has
been written in a database table.
That store procedure will always return the last recorded entry from a table
How to do that ?
regards
sergeHi Serge,
What is the "last" record in your case ?
SQL Server doesn=B4t care about the order of data unless you specify an
Order in a Select query or you can determine the last entry via an
identity column or a column which store the modified date.
HTH, Jens Suessmeyer.|||You need to add datetime column and insert the value when you add a record.
Then you can select the most recent record in the table.
something like
select top 1 <column list>
from table
order by Time_inserted DESC
Thats offcourse if you mean 'last' by time of insert. If you want to handle
updates ('LastChanged') read about timestamp in the BOL.
MC
"serge calderara" <sergecalderara@.discussions.microsoft.com> wrote in
message news:EB64CB5C-40D0-42E2-A56B-31205AB24C7D@.microsoft.com...
> Dear all,
> I am writing a store procedure which should return the last entry whcih
> has
> been written in a database table.
> That store procedure will always return the last recorded entry from a
> table
> How to do that ?
> regards
> serge|||If you don't record the information about which row was the last then
SQL Server won't do it for you. The answer is something like:
SELECT ,,,
FROM your_table
WHERE created_date =
(SELECT MAX(created_date)
FROM your_table) ;
David Portas
SQL Server MVP
--|||Hi Jens,
nased on that, I have a column in my database table Identified as START_TIME
which is of type DataTime.
Based on that column, the "last" record will be the one who have the biggest
DateTIme value.
any tip ?
"Jens" wrote:

> Hi Serge,
> What is the "last" record in your case ?
> SQL Server doesn′t care about the order of data unless you specify an
> Order in a Select query or you can determine the last entry via an
> identity column or a column which store the modified date.
> HTH, Jens Suessmeyer.
>|||Thnaks it works
"MC" wrote:

> You need to add datetime column and insert the value when you add a record
.
> Then you can select the most recent record in the table.
> something like
> select top 1 <column list>
> from table
> order by Time_inserted DESC
> Thats offcourse if you mean 'last' by time of insert. If you want to handl
e
> updates ('LastChanged') read about timestamp in the BOL.
> MC
>
> "serge calderara" <sergecalderara@.discussions.microsoft.com> wrote in
> message news:EB64CB5C-40D0-42E2-A56B-31205AB24C7D@.microsoft.com...
>
>