Showing posts with label message. Show all posts
Showing posts with label message. Show all posts

Thursday, March 22, 2012

Check if fieldname exists?

This is a multi-part message in MIME format.
--=_NextPart_000_001F_01C4A64F.273B6E50
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Can I do a check if a field name exists like in an expression:
iif(Fields!Time_Month.Value,,)
iif(Exists(Fields!Time_Month.Value,,))
--=_NextPart_000_001F_01C4A64F.273B6E50
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&
Can I do a check if a field name exists = like in an expression:

iif(Fields!Time_Month.Value,,)
iif(Exists(Fields!Time_Month.Value,,))



--=_NextPart_000_001F_01C4A64F.273B6E50--Only field names defined in the RDL file will be accessible in the Fields
collection. If a Field defined in the RDL is not returned by the data source
query, the IsMissing property of this field will be true:
=iif(Fields!xxx.IsMissing, "Field is not returned by query", ...)
More information about the Fields collection can be found in BOL:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rscreate/htm/rcr_creating_expressions_v1_7ilv.asp
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Cindy Lee" <cindylee@.hotmail.com> wrote in message
news:%230Ue0nopEHA.3396@.tk2msftngp13.phx.gbl...
Can I do a check if a field name exists like in an expression:
iif(Fields!Time_Month.Value,,)
iif(Exists(Fields!Time_Month.Value,,))|||This is a multi-part message in MIME format.
--=_NextPart_000_0044_01C4A6D7.AE802670
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Ok, I see that, but the problem comes when I try to use that field
=3Diif(Fields!xxx.IsMissing, "Field is not returned by query", "Returned =field is"& Fields!xxx.value)
If the field is there, I get
Returned field is (value)
If the field isn't there I don't get anything back.
I just get a field is missing error
"Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> wrote in message =news:uv2elNppEHA.1992@.TK2MSFTNGP09.phx.gbl...
> Only field names defined in the RDL file will be accessible in the =Fields
> collection. If a Field defined in the RDL is not returned by the data =source
> query, the IsMissing property of this field will be true:
> =3Diif(Fields!xxx.IsMissing, "Field is not returned by query", ...)
> > More information about the Fields collection can be found in BOL:
> =http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/rscrea=
te/htm/rcr_creating_expressions_v1_7ilv.asp
> > --
> This posting is provided "AS IS" with no warranties, and confers no =rights.
> > > > "Cindy Lee" <cindylee@.hotmail.com> wrote in message
> news:%230Ue0nopEHA.3396@.tk2msftngp13.phx.gbl...
> Can I do a check if a field name exists like in an expression:
> > iif(Fields!Time_Month.Value,,)
> iif(Exists(Fields!Time_Month.Value,,))
> >
--=_NextPart_000_0044_01C4A6D7.AE802670
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&

Ok, I see that, but the problem comes =when I try to use that field
=3Diif(Fields!xxx.IsMissing, "Field is =not returned by query", "Returned field is"& Fields!xxx.value)
If the field is there, I get
Returned field is (value)
If the field isn't there I don't get =anything back.
I just get a field is missing =error
"Robert Bruckner [MSFT]" wrote in message news:uv2elNppEHA.1992@.TK2MSFTNGP09.phx.gbl...> =Only field names defined in the RDL file will be accessible in the Fields> =collection. If a Field defined in the RDL is not returned by the data source> =query, the IsMissing property of this field will be true:> =3Diif(Fields!xxx.IsMissing, "Field is not returned by query", =...)> > More information about the Fields collection can be found in BOL:>http://msdn.microsoft.com/library/default.asp?url=3D/library/en-=us/rscreate/htm/rcr_creating_expressions_v1_7ilv.asp> > --> This posting is provided ="AS IS" with no warranties, and confers no rights.> > > > ="Cindy Lee" =wrote in message> news:%230Ue0nopEHA.3396@.tk2msftngp13.phx.gbl...> Can I do a check if a field name exists like in an expression:> > iif(Fields!Time_Month.Value,,)> iif(Exists(Fields!Time_Month.Value,,))> > =

--=_NextPart_000_0044_01C4A6D7.AE802670--

Tuesday, March 20, 2012

Check if a windows/nt user account exists

I have some script which creates/grant priveleges to windows/nt users to DB but i frequently get the message below:

Windows NT user or group '<user or group>' not found. Check the name again.

I understand that this is because the said user/group is indeed not present in the environment I'm running the script (ie. testing and production environment).

But is it possible to have some sort of checking whether the user/group exists in the environment so that I could determine whether or not to call some lines of code?

Not sure if this is possible so i had to ask. c",)

SELECT *

FROM sysusers

will show the users from the current database. There are columns like isntname and isntgroup that will tell you if it is an NT user name or group. There are more than just the normal users, so take a look at what is in that table.

|||

If i'm not mistaken that will only show users already registered for the current database.

I needed to check if a NT user name/group is valid/exists in the environment rather than if it is registered for the current database.

Appreciate your help but i think i need something else or could you expound how would that apply for my objective?

Thanks in advance

|||

What version of SQL Server are you using? You could use SUSER_SID('<your_windows_login_name>' and check for non-null value. But this method depends on your configuration - the SQL Server service account, member server or standalone server etc. So there is no easy way to do this from the database engine.

You could use the ADSI OLEDB provider and perform distributed queries but this depends on your network configuration & whether LDAP is allowed and so on. In SQL Server 2005, you can write SQLCLR function to perform the check but this requires enabling CLR on the server, creating assembly with possibly UNSAFE or minimum of EXTERNAL_ACCESS permissions.

Best is to perform the check outside of the database, filter the list of users and create the logins. Or you can simply perform the error check in TSQL. This is also easier with TRY..CATCH in SQL Server 2005.

|||Thanks, will definitely try to look into these.|||I think i'll just go for the try-catch. Thanks|||Try catch should be fine, but be careful that you don't need speed. Performance will be a bigger concern just catching the error instead of checking for it first.

Monday, March 19, 2012

CHECK DB

Hi
When i execute dbcc checkdb in the database i am getting the error message "CHECKDB found 2 allocation errors and 0 consistency errors not associated with any single object."
Detail of the error messages are
Page (1:3978) in database ID 11 is allocated in the SGAM (1:3) and PFS (1:1), but was not allocated in any IAM. PFS flags 'MIXED_EXT ALLOCATED 0_PCT_FULL'.
Page (1:3979) in database ID 11 is allocated in the SGAM (1:3) and PFS (1:1), but was not allocated in any IAM. PFS flags 'IAM_PG MIXED_EXT ALLOCATED 0_PCT_FULL'.
How to repair the Database .Plz help me
Thanks
Aravind
Thanks
Aravind
Aravind,
Refer DBCC CHECKDB in BooksOnLine.It lists options where you can repair the
data.It says:
" DBCC CHECKDB is the safest repair statement because it identifies and
repairs the widest possible errors. If only allocation errors are reported
for a database, execute DBCC CHECKALLOC with a repair option to repair these
errors. However, to ensure that all errors, including allocation errors, are
properly repaired, execute DBCC CHECKDB with a repair option rather than
DBCC CHECKALLOC with a repair option. "
Dinesh
SQL Server MVP
--
SQL Server FAQ at
http://www.tkdinesh.com
"Aravind" <anonymous@.discussions.microsoft.com> wrote in message
news:B58E6708-2566-4D59-B567-669D3E1E829E@.microsoft.com...
> Hi
> When i execute dbcc checkdb in the database i am getting the error
message "CHECKDB found 2 allocation errors and 0 consistency errors not
associated with any single object."
> Detail of the error messages are
> Page (1:3978) in database ID 11 is allocated in the SGAM (1:3) and PFS
(1:1), but was not allocated in any IAM. PFS flags 'MIXED_EXT ALLOCATED
0_PCT_FULL'.
> Page (1:3979) in database ID 11 is allocated in the SGAM (1:3) and PFS
(1:1), but was not allocated in any IAM. PFS flags 'IAM_PG MIXED_EXT
ALLOCATED 0_PCT_FULL'.
> How to repair the Database .Plz help me
> Thanks
> Aravind
>
> Thanks
> Aravind
|||Aravind
Have you tried to use REPAIR option which is given by Microsoft?
DBCC CHECKDB
( 'database_name'
[ , NOINDEX
| { REPAIR_ALLOW_DATA_LOSS
| REPAIR_FAST
| REPAIR_REBUILD
} ]
) [ WITH { [ ALL_ERRORMSGS ]
[ , [ NO_INFOMSGS ] ]
[ , [ TABLOCK ] ]
[ , [ ESTIMATEONLY ] ]
[ , [ PHYSICAL_ONLY ] ]
}
]
"Aravind" <anonymous@.discussions.microsoft.com> wrote in message
news:B58E6708-2566-4D59-B567-669D3E1E829E@.microsoft.com...
> Hi
> When i execute dbcc checkdb in the database i am getting the error
message "CHECKDB found 2 allocation errors and 0 consistency errors not
associated with any single object."
> Detail of the error messages are
> Page (1:3978) in database ID 11 is allocated in the SGAM (1:3) and PFS
(1:1), but was not allocated in any IAM. PFS flags 'MIXED_EXT ALLOCATED
0_PCT_FULL'.
> Page (1:3979) in database ID 11 is allocated in the SGAM (1:3) and PFS
(1:1), but was not allocated in any IAM. PFS flags 'IAM_PG MIXED_EXT
ALLOCATED 0_PCT_FULL'.
> How to repair the Database .Plz help me
> Thanks
> Aravind
>
> Thanks
> Aravind
|||Make sure you have the updated books online, as it contains specific instructions on how to deal with
different DBCC errors. Your error number seems to be 8906. Here's an online link to the specific suggestions
for that error:
http://msdn.microsoft.com/library/de...err_2_6eye.asp
And here's a generic link on handling database corruption:
http://www.karaszi.com/sqlserver/inf...suspect_db.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Aravind" <anonymous@.discussions.microsoft.com> wrote in message
news:B58E6708-2566-4D59-B567-669D3E1E829E@.microsoft.com...
> Hi
> When i execute dbcc checkdb in the database i am getting the error message "CHECKDB found 2 allocation
errors and 0 consistency errors not associated with any single object."
> Detail of the error messages are
> Page (1:3978) in database ID 11 is allocated in the SGAM (1:3) and PFS (1:1), but was not allocated in any
IAM. PFS flags 'MIXED_EXT ALLOCATED 0_PCT_FULL'.
> Page (1:3979) in database ID 11 is allocated in the SGAM (1:3) and PFS (1:1), but was not allocated in any
IAM. PFS flags 'IAM_PG MIXED_EXT ALLOCATED 0_PCT_FULL'.
> How to repair the Database .Plz help me
> Thanks
> Aravind
>
> Thanks
> Aravind

CHECK DB

H
When i execute dbcc checkdb in the database i am getting the error message "CHECKDB found 2 allocation errors and 0 consistency errors not associated with any single object."
Detail of the error messages ar
Page (1:3978) in database ID 11 is allocated in the SGAM (1:3) and PFS (1:1), but was not allocated in any IAM. PFS flags 'MIXED_EXT ALLOCATED 0_PCT_FULL'
Page (1:3979) in database ID 11 is allocated in the SGAM (1:3) and PFS (1:1), but was not allocated in any IAM. PFS flags 'IAM_PG MIXED_EXT ALLOCATED 0_PCT_FULL'
How to repair the Database .Plz help m
Thank
Aravin
Thank
AravindAravind,
Refer DBCC CHECKDB in BooksOnLine.It lists options where you can repair the
data.It says:
" DBCC CHECKDB is the safest repair statement because it identifies and
repairs the widest possible errors. If only allocation errors are reported
for a database, execute DBCC CHECKALLOC with a repair option to repair these
errors. However, to ensure that all errors, including allocation errors, are
properly repaired, execute DBCC CHECKDB with a repair option rather than
DBCC CHECKALLOC with a repair option. "
--
Dinesh
SQL Server MVP
--
--
SQL Server FAQ at
http://www.tkdinesh.com
"Aravind" <anonymous@.discussions.microsoft.com> wrote in message
news:B58E6708-2566-4D59-B567-669D3E1E829E@.microsoft.com...
> Hi
> When i execute dbcc checkdb in the database i am getting the error
message "CHECKDB found 2 allocation errors and 0 consistency errors not
associated with any single object."
> Detail of the error messages are
> Page (1:3978) in database ID 11 is allocated in the SGAM (1:3) and PFS
(1:1), but was not allocated in any IAM. PFS flags 'MIXED_EXT ALLOCATED
0_PCT_FULL'.
> Page (1:3979) in database ID 11 is allocated in the SGAM (1:3) and PFS
(1:1), but was not allocated in any IAM. PFS flags 'IAM_PG MIXED_EXT
ALLOCATED 0_PCT_FULL'.
> How to repair the Database .Plz help me
> Thanks
> Aravind
>
> Thanks
> Aravind|||Aravind
Have you tried to use REPAIR option which is given by Microsoft?
DBCC CHECKDB
( 'database_name'
[ , NOINDEX
| { REPAIR_ALLOW_DATA_LOSS
| REPAIR_FAST
| REPAIR_REBUILD
} ]
) [ WITH { [ ALL_ERRORMSGS ]
[ , [ NO_INFOMSGS ] ]
[ , [ TABLOCK ] ]
[ , [ ESTIMATEONLY ] ]
[ , [ PHYSICAL_ONLY ] ]
}
]
"Aravind" <anonymous@.discussions.microsoft.com> wrote in message
news:B58E6708-2566-4D59-B567-669D3E1E829E@.microsoft.com...
> Hi
> When i execute dbcc checkdb in the database i am getting the error
message "CHECKDB found 2 allocation errors and 0 consistency errors not
associated with any single object."
> Detail of the error messages are
> Page (1:3978) in database ID 11 is allocated in the SGAM (1:3) and PFS
(1:1), but was not allocated in any IAM. PFS flags 'MIXED_EXT ALLOCATED
0_PCT_FULL'.
> Page (1:3979) in database ID 11 is allocated in the SGAM (1:3) and PFS
(1:1), but was not allocated in any IAM. PFS flags 'IAM_PG MIXED_EXT
ALLOCATED 0_PCT_FULL'.
> How to repair the Database .Plz help me
> Thanks
> Aravind
>
> Thanks
> Aravind|||Make sure you have the updated books online, as it contains specific instructions on how to deal with
different DBCC errors. Your error number seems to be 8906. Here's an online link to the specific suggestions
for that error:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/trblsql/tr_reslsyserr_2_6eye.asp
And here's a generic link on handling database corruption:
http://www.karaszi.com/sqlserver/info_corrupt_suspect_db.asp
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Aravind" <anonymous@.discussions.microsoft.com> wrote in message
news:B58E6708-2566-4D59-B567-669D3E1E829E@.microsoft.com...
> Hi
> When i execute dbcc checkdb in the database i am getting the error message "CHECKDB found 2 allocation
errors and 0 consistency errors not associated with any single object."
> Detail of the error messages are
> Page (1:3978) in database ID 11 is allocated in the SGAM (1:3) and PFS (1:1), but was not allocated in any
IAM. PFS flags 'MIXED_EXT ALLOCATED 0_PCT_FULL'.
> Page (1:3979) in database ID 11 is allocated in the SGAM (1:3) and PFS (1:1), but was not allocated in any
IAM. PFS flags 'IAM_PG MIXED_EXT ALLOCATED 0_PCT_FULL'.
> How to repair the Database .Plz help me
> Thanks
> Aravind
>
> Thanks
> Aravind

CHECK DB

Hi
When i execute dbcc checkdb in the database i am getting the error messag
e "CHECKDB found 2 allocation errors and 0 consistency errors not associated
with any single object."
Detail of the error messages are
Page (1:3978) in database ID 11 is allocated in the SGAM (1:3) and PFS (1:1)
, but was not allocated in any IAM. PFS flags 'MIXED_EXT ALLOCATED 0_PCT_F
ULL'.
Page (1:3979) in database ID 11 is allocated in the SGAM (1:3) and PFS (1:1)
, but was not allocated in any IAM. PFS flags 'IAM_PG MIXED_EXT ALLOCATED
0_PCT_FULL'.
How to repair the Database .Plz help me
Thanks
Aravind
Thanks
AravindAravind,
Refer DBCC CHECKDB in BooksOnLine.It lists options where you can repair the
data.It says:
" DBCC CHECKDB is the safest repair statement because it identifies and
repairs the widest possible errors. If only allocation errors are reported
for a database, execute DBCC CHECKALLOC with a repair option to repair these
errors. However, to ensure that all errors, including allocation errors, are
properly repaired, execute DBCC CHECKDB with a repair option rather than
DBCC CHECKALLOC with a repair option. "
Dinesh
SQL Server MVP
--
--
SQL Server FAQ at
http://www.tkdinesh.com
"Aravind" <anonymous@.discussions.microsoft.com> wrote in message
news:B58E6708-2566-4D59-B567-669D3E1E829E@.microsoft.com...
> Hi
> When i execute dbcc checkdb in the database i am getting the error
message "CHECKDB found 2 allocation errors and 0 consistency errors not
associated with any single object."
> Detail of the error messages are
> Page (1:3978) in database ID 11 is allocated in the SGAM (1:3) and PFS
(1:1), but was not allocated in any IAM. PFS flags 'MIXED_EXT ALLOCATED
0_PCT_FULL'.
> Page (1:3979) in database ID 11 is allocated in the SGAM (1:3) and PFS
(1:1), but was not allocated in any IAM. PFS flags 'IAM_PG MIXED_EXT
ALLOCATED 0_PCT_FULL'.
> How to repair the Database .Plz help me
> Thanks
> Aravind
>
> Thanks
> Aravind|||Aravind
Have you tried to use REPAIR option which is given by Microsoft?
DBCC CHECKDB
( 'database_name'
[ , NOINDEX
| { REPAIR_ALLOW_DATA_LOSS
| REPAIR_FAST
| REPAIR_REBUILD
} ]
) [ WITH { [ ALL_ERRORMSGS ]
[ , [ NO_INFOMSGS ] ]
[ , [ TABLOCK ] ]
[ , [ ESTIMATEONLY ] ]
[ , [ PHYSICAL_ONLY ] ]
}
]
"Aravind" <anonymous@.discussions.microsoft.com> wrote in message
news:B58E6708-2566-4D59-B567-669D3E1E829E@.microsoft.com...
> Hi
> When i execute dbcc checkdb in the database i am getting the error
message "CHECKDB found 2 allocation errors and 0 consistency errors not
associated with any single object."
> Detail of the error messages are
> Page (1:3978) in database ID 11 is allocated in the SGAM (1:3) and PFS
(1:1), but was not allocated in any IAM. PFS flags 'MIXED_EXT ALLOCATED
0_PCT_FULL'.
> Page (1:3979) in database ID 11 is allocated in the SGAM (1:3) and PFS
(1:1), but was not allocated in any IAM. PFS flags 'IAM_PG MIXED_EXT
ALLOCATED 0_PCT_FULL'.
> How to repair the Database .Plz help me
> Thanks
> Aravind
>
> Thanks
> Aravind|||Make sure you have the updated books online, as it contains specific instruc
tions on how to deal with
different DBCC errors. Your error number seems to be 8906. Here's an online
link to the specific suggestions
for that error:
serr_2_6eye.asp" target="_blank">http://msdn.microsoft.com/library/d...serr_2_6eye.asp
And here's a generic link on handling database corruption:
http://www.karaszi.com/sqlserver/in..._suspect_db.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Aravind" <anonymous@.discussions.microsoft.com> wrote in message
news:B58E6708-2566-4D59-B567-669D3E1E829E@.microsoft.com...
> Hi
> When i execute dbcc checkdb in the database i am getting the error message "CHE
CKDB found 2 allocation
errors and 0 consistency errors not associated with any single object."
> Detail of the error messages are
> Page (1:3978) in database ID 11 is allocated in the SGAM (1:3) and PFS (1:1), but
was not allocated in any
IAM. PFS flags 'MIXED_EXT ALLOCATED 0_PCT_FULL'.
> Page (1:3979) in database ID 11 is allocated in the SGAM (1:3) and PFS (1:1), but
was not allocated in any
IAM. PFS flags 'IAM_PG MIXED_EXT ALLOCATED 0_PCT_FULL'.
> How to repair the Database .Plz help me
> Thanks
> Aravind
>
> Thanks
> Aravind

Sunday, March 11, 2012

Check Contraint question

This is a multi-part message in MIME format.
--=_NextPart_000_0008_01C67383.F9AD44F0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I have the following check constraint
(isnull(patindex(('%[' + ' ' + char(9) + char(10) + char(13) + = ']%'),[LicensePlateNumber]),0) =3D 0)
which works fine, throwing an error if those characters are entered. Is = there a way to have it not throw an error, but rather just remove the = offending characters if entered? Thanks
--=_NextPart_000_0008_01C67383.F9AD44F0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&
I have the following check constraint

(isnull(patindex(('%[' + ' ' + = char(9) + char(10) + char(13) + ']%'),[LicensePlateNumber]),0) =3D 0)

which works fine, throwing an = error if those characters are entered. Is there a way to have it not throw = an error, but rather just remove the offending characters if entered? = Thanks
--=_NextPart_000_0008_01C67383.F9AD44F0--No, that's not what a constraint does.
You can perhaps use an instead-of trigger to achieve this functionality.
Conor
"Burma Jones" <somebody@.somedomain.not> wrote in message
news:%23lJiq67cGHA.4892@.TK2MSFTNGP02.phx.gbl...
I have the following check constraint
(isnull(patindex(('%[' + ' ' + char(9) + char(10) + char(13) +
']%'),[LicensePlateNumber]),0) = 0)
which works fine, throwing an error if those characters are entered. Is
there a way to have it not throw an error, but rather just remove the
offending characters if entered? Thanks|||No. Constraints are declarative and do not perform actions. I would
do this kind of thing inthe front end or in the inpout procedure.
Triggers will fire any time the table is touched and work on all rows,
so they can be a bit costly.|||Since this is only a few thousand records, I'm not too worried about the
cost of using a trigger. Can you share an example, even pseudocode, showing
how to create a trigger which will remove those characters? Thanks
"Conor Cunningham [MS]" <conorc_removeme@.online.microsoft.com> wrote in
message news:eu$9uj9cGHA.4932@.TK2MSFTNGP03.phx.gbl...
> No, that's not what a constraint does.
> You can perhaps use an instead-of trigger to achieve this functionality.
> Conor
> "Burma Jones" <somebody@.somedomain.not> wrote in message
> news:%23lJiq67cGHA.4892@.TK2MSFTNGP02.phx.gbl...
> I have the following check constraint
> (isnull(patindex(('%[' + ' ' + char(9) + char(10) + char(13) +
> ']%'),[LicensePlateNumber]),0) = 0)
> which works fine, throwing an error if those characters are entered. Is
> there a way to have it not throw an error, but rather just remove the
> offending characters if entered? Thanks
>|||On Wed, 10 May 2006 08:26:16 -0700, Burma Jones wrote:
>Since this is only a few thousand records, I'm not too worried about the
>cost of using a trigger. Can you share an example, even pseudocode, showing
>how to create a trigger which will remove those characters? Thanks
Hi Burma,
Here's a sample trigger that will remove the offending characters
silently:
CREATE TRIGGER YourTrigger
ON YourTable INSTEAD OF INSERT
AS
INSERT INTO YourTable (OtherColumns, LicensePlate)
SELECT OtherColumns,
REPLACE(REPLACE(REPLACE(REPLACE(LicensePlate, ' ', ''), CHAR(9),
''), CHAR(10), ''), CHAR(13), ''), OtherColumns
FROM inserted
go
(untested - see www.aspfaq.com/5006 if you prefer a tested reply)
--
Hugo Kornelis, SQL Server MVP

Thursday, March 8, 2012

Check constraint and foreign key error

The error message for err. 547 is:
"%ls statement conflicted with %ls %ls constraint '%.*ls'. The conflict
occurred in database '%.*ls', table '%.*ls'%ls%.*ls%ls."
This error is raised when a foreign key error is occured, and when a check
constraint error occured, too.
What kind of values can have the parameters of this error message? How can I
know, what kind of error is this?
thanks
-enci-Unfortunately there's no system variable that gives you the actual error
message, so that you could parse it for more information. But from a client
application, you should be able to access the error message. For example,
Err.Description in ADO.
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Eniko Tegen" <EnikoTegen@.discussions.microsoft.com> wrote in message
news:04C8D5D7-D273-4D68-9757-31DF9ED09867@.microsoft.com...
The error message for err. 547 is:
"%ls statement conflicted with %ls %ls constraint '%.*ls'. The conflict
occurred in database '%.*ls', table '%.*ls'%ls%.*ls%ls."
This error is raised when a foreign key error is occured, and when a check
constraint error occured, too.
What kind of values can have the parameters of this error message? How can I
know, what kind of error is this?
thanks
-enci-|||I have the error message, but I want to format and translate it. And I didn'
t
know what kind of values can have the messages parameters. I have diferent
messages and todo's in case of check constraint and diferent in case of
foreign keys. And I didn't know what kind of any errors can appear with this
error number.
thanks
-enci-
"Narayana Vyas Kondreddi" wrote:

> Unfortunately there's no system variable that gives you the actual error
> message, so that you could parse it for more information. But from a clien
t
> application, you should be able to access the error message. For example,
> Err.Description in ADO.
> --
> HTH,
> Vyas, MVP (SQL Server)
> SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
>
> "Eniko Tegen" <EnikoTegen@.discussions.microsoft.com> wrote in message
> news:04C8D5D7-D273-4D68-9757-31DF9ED09867@.microsoft.com...
> The error message for err. 547 is:
> "%ls statement conflicted with %ls %ls constraint '%.*ls'. The conflict
> occurred in database '%.*ls', table '%.*ls'%ls%.*ls%ls."
> This error is raised when a foreign key error is occured, and when a check
> constraint error occured, too.
> What kind of values can have the parameters of this error message? How can
I
> know, what kind of error is this?
> thanks
> -enci-
>
>