Hi,
I am trying to delete data from a field in my table, I want to clear all the
data from one field in my table (assuming the table is Students and the
field is firstName)
Thank you in advance.
LamyDo you want to set the column to NULL or an empty string? In any case, it is
a simple UPDATE
statements:
UPDATE tblname
SET colname = NULL
or
UPDATE tblname
SET colname = ''
Note that both above will modify all rows. Add a WHERE clause of you want to
limit.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Lamy" <lamine_d@.mpt-ltd.com> wrote in message news:%23Y0CLe2dHHA.2088@.TK2MSFTNGP05.phx.gbl.
.
> Hi,
> I am trying to delete data from a field in my table, I want to clear all t
he data from one field
> in my table (assuming the table is Students and the field is firstName)
> Thank you in advance.
> Lamy
>|||If the column you need to delete is nullable, you simply can:
UPDATE Students
SET firstName = NULL
If the column isn't nullable you could
UPDATE Students
SET firstName = expression | DEFAULT
if some default is defined you can use it; expression is any expression
resulting in an empty field. Remember that NULL is different from "empty" or
blank.
Gilberto
"Lamy" wrote:
> Hi,
> I am trying to delete data from a field in my table, I want to clear all t
he
> data from one field in my table (assuming the table is Students and the
> field is firstName)
> Thank you in advance.
> Lamy
>
>|||Dear Tibor and Gilberto,
Silly me.
Many thanks guys.
Regards
Lamine
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:OOru0t2dHHA.4384@.TK2MSFTNGP03.phx.gbl...
> Do you want to set the column to NULL or an empty string? In any case, it
> is a simple UPDATE statements:
> UPDATE tblname
> SET colname = NULL
> or
> UPDATE tblname
> SET colname = ''
> Note that both above will modify all rows. Add a WHERE clause of you want
> to limit.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Lamy" <lamine_d@.mpt-ltd.com> wrote in message
> news:%23Y0CLe2dHHA.2088@.TK2MSFTNGP05.phx.gbl...
>
Showing posts with label clear. Show all posts
Showing posts with label clear. Show all posts
Thursday, March 29, 2012
Tuesday, March 27, 2012
delete data from a field in a table
Hi,
I am trying to delete data from a field in my table, I want to clear all the
data from one field in my table (assuming the table is Students and the
field is firstName)
Thank you in advance.
LamyDo you want to set the column to NULL or an empty string? In any case, it is a simple UPDATE
statements:
UPDATE tblname
SET colname = NULL
or
UPDATE tblname
SET colname = ''
Note that both above will modify all rows. Add a WHERE clause of you want to limit.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Lamy" <lamine_d@.mpt-ltd.com> wrote in message news:%23Y0CLe2dHHA.2088@.TK2MSFTNGP05.phx.gbl...
> Hi,
> I am trying to delete data from a field in my table, I want to clear all the data from one field
> in my table (assuming the table is Students and the field is firstName)
> Thank you in advance.
> Lamy
>|||If the column you need to delete is nullable, you simply can:
UPDATE Students
SET firstName = NULL
If the column isn't nullable you could
UPDATE Students
SET firstName = expression | DEFAULT
if some default is defined you can use it; expression is any expression
resulting in an empty field. Remember that NULL is different from "empty" or
blank.
Gilberto
"Lamy" wrote:
> Hi,
> I am trying to delete data from a field in my table, I want to clear all the
> data from one field in my table (assuming the table is Students and the
> field is firstName)
> Thank you in advance.
> Lamy
>
>|||Dear Tibor and Gilberto,
Silly me.
Many thanks guys.
Regards
Lamine
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:OOru0t2dHHA.4384@.TK2MSFTNGP03.phx.gbl...
> Do you want to set the column to NULL or an empty string? In any case, it
> is a simple UPDATE statements:
> UPDATE tblname
> SET colname = NULL
> or
> UPDATE tblname
> SET colname = ''
> Note that both above will modify all rows. Add a WHERE clause of you want
> to limit.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Lamy" <lamine_d@.mpt-ltd.com> wrote in message
> news:%23Y0CLe2dHHA.2088@.TK2MSFTNGP05.phx.gbl...
>> Hi,
>> I am trying to delete data from a field in my table, I want to clear all
>> the data from one field in my table (assuming the table is Students and
>> the field is firstName)
>> Thank you in advance.
>> Lamy
>sql
I am trying to delete data from a field in my table, I want to clear all the
data from one field in my table (assuming the table is Students and the
field is firstName)
Thank you in advance.
LamyDo you want to set the column to NULL or an empty string? In any case, it is a simple UPDATE
statements:
UPDATE tblname
SET colname = NULL
or
UPDATE tblname
SET colname = ''
Note that both above will modify all rows. Add a WHERE clause of you want to limit.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Lamy" <lamine_d@.mpt-ltd.com> wrote in message news:%23Y0CLe2dHHA.2088@.TK2MSFTNGP05.phx.gbl...
> Hi,
> I am trying to delete data from a field in my table, I want to clear all the data from one field
> in my table (assuming the table is Students and the field is firstName)
> Thank you in advance.
> Lamy
>|||If the column you need to delete is nullable, you simply can:
UPDATE Students
SET firstName = NULL
If the column isn't nullable you could
UPDATE Students
SET firstName = expression | DEFAULT
if some default is defined you can use it; expression is any expression
resulting in an empty field. Remember that NULL is different from "empty" or
blank.
Gilberto
"Lamy" wrote:
> Hi,
> I am trying to delete data from a field in my table, I want to clear all the
> data from one field in my table (assuming the table is Students and the
> field is firstName)
> Thank you in advance.
> Lamy
>
>|||Dear Tibor and Gilberto,
Silly me.
Many thanks guys.
Regards
Lamine
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:OOru0t2dHHA.4384@.TK2MSFTNGP03.phx.gbl...
> Do you want to set the column to NULL or an empty string? In any case, it
> is a simple UPDATE statements:
> UPDATE tblname
> SET colname = NULL
> or
> UPDATE tblname
> SET colname = ''
> Note that both above will modify all rows. Add a WHERE clause of you want
> to limit.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Lamy" <lamine_d@.mpt-ltd.com> wrote in message
> news:%23Y0CLe2dHHA.2088@.TK2MSFTNGP05.phx.gbl...
>> Hi,
>> I am trying to delete data from a field in my table, I want to clear all
>> the data from one field in my table (assuming the table is Students and
>> the field is firstName)
>> Thank you in advance.
>> Lamy
>sql
Sunday, March 25, 2012
delete all data and restart key count to 0
How do I clear all the entrys from a table and make the keys start all overIf u need the current records again u can copy the records to some new table drop the identity column and create it again with the proper seed and import the data back from the temp table.|||truncate table will remove all data and reset the IDENTITY counter to the original seed
Sunday, March 11, 2012
Defrag Indexes
Sorry for the newbie question but can't seem to find a clear anwser...
Is there a command in SQL 2000 to Defrag all Indexes?
ThanksYes! - Look at the DBCC INDEXDEFRAG command in BOL.
Immy
"M Swancott" <swancott@.metrocast.net> wrote in message
news:OSP6VeHtFHA.2912@.TK2MSFTNGP09.phx.gbl...
> Sorry for the newbie question but can't seem to find a clear anwser...
> Is there a command in SQL 2000 to Defrag all Indexes?
> Thanks
>|||You probably don't need to defrag all your indexes. Read the MS whitepaper
below for more details about fragmentation and when/how to remove it.
http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/ss2kidbp.mspx
Thanks
--
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Imtiaz Ullah" <imtiaz_ullah@.hotmail.com> wrote in message
news:uf5Z7gHtFHA.3604@.tk2msftngp13.phx.gbl...
> Yes! - Look at the DBCC INDEXDEFRAG command in BOL.
> Immy
> "M Swancott" <swancott@.metrocast.net> wrote in message
> news:OSP6VeHtFHA.2912@.TK2MSFTNGP09.phx.gbl...
>> Sorry for the newbie question but can't seem to find a clear anwser...
>> Is there a command in SQL 2000 to Defrag all Indexes?
>> Thanks
>>
>
Is there a command in SQL 2000 to Defrag all Indexes?
ThanksYes! - Look at the DBCC INDEXDEFRAG command in BOL.
Immy
"M Swancott" <swancott@.metrocast.net> wrote in message
news:OSP6VeHtFHA.2912@.TK2MSFTNGP09.phx.gbl...
> Sorry for the newbie question but can't seem to find a clear anwser...
> Is there a command in SQL 2000 to Defrag all Indexes?
> Thanks
>|||You probably don't need to defrag all your indexes. Read the MS whitepaper
below for more details about fragmentation and when/how to remove it.
http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/ss2kidbp.mspx
Thanks
--
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Imtiaz Ullah" <imtiaz_ullah@.hotmail.com> wrote in message
news:uf5Z7gHtFHA.3604@.tk2msftngp13.phx.gbl...
> Yes! - Look at the DBCC INDEXDEFRAG command in BOL.
> Immy
> "M Swancott" <swancott@.metrocast.net> wrote in message
> news:OSP6VeHtFHA.2912@.TK2MSFTNGP09.phx.gbl...
>> Sorry for the newbie question but can't seem to find a clear anwser...
>> Is there a command in SQL 2000 to Defrag all Indexes?
>> Thanks
>>
>
Defrag Indexes
Sorry for the newbie question but can't seem to find a clear anwser...
Is there a command in SQL 2000 to Defrag all Indexes?
Thanks
Yes! - Look at the DBCC INDEXDEFRAG command in BOL.
Immy
"M Swancott" <swancott@.metrocast.net> wrote in message
news:OSP6VeHtFHA.2912@.TK2MSFTNGP09.phx.gbl...
> Sorry for the newbie question but can't seem to find a clear anwser...
> Is there a command in SQL 2000 to Defrag all Indexes?
> Thanks
>
|||You probably don't need to defrag all your indexes. Read the MS whitepaper
below for more details about fragmentation and when/how to remove it.
http://www.microsoft.com/technet/pro.../ss2kidbp.mspx
Thanks
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Imtiaz Ullah" <imtiaz_ullah@.hotmail.com> wrote in message
news:uf5Z7gHtFHA.3604@.tk2msftngp13.phx.gbl...
> Yes! - Look at the DBCC INDEXDEFRAG command in BOL.
> Immy
> "M Swancott" <swancott@.metrocast.net> wrote in message
> news:OSP6VeHtFHA.2912@.TK2MSFTNGP09.phx.gbl...
>
Is there a command in SQL 2000 to Defrag all Indexes?
Thanks
Yes! - Look at the DBCC INDEXDEFRAG command in BOL.
Immy
"M Swancott" <swancott@.metrocast.net> wrote in message
news:OSP6VeHtFHA.2912@.TK2MSFTNGP09.phx.gbl...
> Sorry for the newbie question but can't seem to find a clear anwser...
> Is there a command in SQL 2000 to Defrag all Indexes?
> Thanks
>
|||You probably don't need to defrag all your indexes. Read the MS whitepaper
below for more details about fragmentation and when/how to remove it.
http://www.microsoft.com/technet/pro.../ss2kidbp.mspx
Thanks
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Imtiaz Ullah" <imtiaz_ullah@.hotmail.com> wrote in message
news:uf5Z7gHtFHA.3604@.tk2msftngp13.phx.gbl...
> Yes! - Look at the DBCC INDEXDEFRAG command in BOL.
> Immy
> "M Swancott" <swancott@.metrocast.net> wrote in message
> news:OSP6VeHtFHA.2912@.TK2MSFTNGP09.phx.gbl...
>
Defrag Indexes
Sorry for the newbie question but can't seem to find a clear anwser...
Is there a command in SQL 2000 to Defrag all Indexes?
ThanksYes! - Look at the DBCC INDEXDEFRAG command in BOL.
Immy
"M Swancott" <swancott@.metrocast.net> wrote in message
news:OSP6VeHtFHA.2912@.TK2MSFTNGP09.phx.gbl...
> Sorry for the newbie question but can't seem to find a clear anwser...
> Is there a command in SQL 2000 to Defrag all Indexes?
> Thanks
>|||You probably don't need to defrag all your indexes. Read the MS whitepaper
below for more details about fragmentation and when/how to remove it.
http://www.microsoft.com/technet/pr...n/ss2kidbp.mspx
Thanks
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Imtiaz Ullah" <imtiaz_ullah@.hotmail.com> wrote in message
news:uf5Z7gHtFHA.3604@.tk2msftngp13.phx.gbl...
> Yes! - Look at the DBCC INDEXDEFRAG command in BOL.
> Immy
> "M Swancott" <swancott@.metrocast.net> wrote in message
> news:OSP6VeHtFHA.2912@.TK2MSFTNGP09.phx.gbl...
>
Is there a command in SQL 2000 to Defrag all Indexes?
ThanksYes! - Look at the DBCC INDEXDEFRAG command in BOL.
Immy
"M Swancott" <swancott@.metrocast.net> wrote in message
news:OSP6VeHtFHA.2912@.TK2MSFTNGP09.phx.gbl...
> Sorry for the newbie question but can't seem to find a clear anwser...
> Is there a command in SQL 2000 to Defrag all Indexes?
> Thanks
>|||You probably don't need to defrag all your indexes. Read the MS whitepaper
below for more details about fragmentation and when/how to remove it.
http://www.microsoft.com/technet/pr...n/ss2kidbp.mspx
Thanks
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Imtiaz Ullah" <imtiaz_ullah@.hotmail.com> wrote in message
news:uf5Z7gHtFHA.3604@.tk2msftngp13.phx.gbl...
> Yes! - Look at the DBCC INDEXDEFRAG command in BOL.
> Immy
> "M Swancott" <swancott@.metrocast.net> wrote in message
> news:OSP6VeHtFHA.2912@.TK2MSFTNGP09.phx.gbl...
>
Subscribe to:
Posts (Atom)