Showing posts with label override. Show all posts
Showing posts with label override. Show all posts

Saturday, February 25, 2012

Override SQL character

I'm trying to search for all records that contain a quotation character in the database. These records were migrated from a mainframe system.

I use the following command:
%'%

The results are:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Unclosed quotation mark before the character string ' order by cliLastName, cliFirstName, cliBirthName'.

/ladds/lib/getrecordset.asp, line 6

Is there a way to override the quotation character temporarily?

Thanks ...You just have to escape the character. Use this:

like '%''%'

That is, two single quotes, and not a double quote.|||Thanks ... worked like a charm!

override labels for boolean report parameter

I'm trying to override the true/false labels you get when you create a
boolean report parameter. I've tried creating a dataset that I use for my
available values but that didn't work either... Has anyone ever done this or
have any ideas...If you are using the reportviewer you con do that by applying custom language
to it.
look for localysing the report viewer and you will find what you are looking
for.
"Alien2_51" wrote:
> I'm trying to override the true/false labels you get when you create a
> boolean report parameter. I've tried creating a dataset that I use for my
> available values but that didn't work either... Has anyone ever done this or
> have any ideas...

Override Identity Column using Datatable

I need copy a table from a remote (hosted) SQL 2000 database server to my local machine. I don't have access to backups and am unable to correctly configure my local machine to add a linked server. So I plan to retrieve the data to a datatable, copy it in code and save it to my local server. But the table contains an identity column which I will need to insert the values manually so they match the original.

Can anyone tell me how I can set the datatable's save to use my manual values instead of the autonumber value?

Thanks.

there are two options

1. First remove the constraint on identity column, then import the data, after that apply the constraint on iidentity column.

2. Add another column for it,

|||

SET IDENTITY_INSERT {YourTableName} ON

INSERT INTO {YourTableName} ....

SET IDENTITY_INSERT {YourTableName} OFF

|||

Thank you for the response Motley, but I don't want to have to create SQL statements; I want to do this directly in code using a datatable. Do you know how to do that?

|||

If you do not want to write sql query, then I suggest to go for answer1, turn off identity feature, import the data and turn it on.

|||

You would use the "SQL Statements" I gave above in a sqldataadapters's updatecommand.

|||

Hi,

Actually the code is also calling the SQL statements to do the update. So you will always need some SQL Statements for updating.

I suggest you use the way Girijesh has provided. Turn off the identity contraint off and import data.

HTH. If this does not answer your question, please feel free to mark the post as Not Answered and reply. Thank you!

Override constraints

I have to change someones username in my database in a couple of tables. When I try to make any changes, I get an error that there is a constraint. Is there a way to make the changes without removing all the constraints then replacing them?
Thanksheh. sucky. take a look at your constraints to see if they're really necessary. Or follow the correct insertion plan so the contstraints don't block you.

if it weren't 2000, I'd say SET DISABLE_DEF_CNST_CHK, but that's no longer supported.

Override Checking...?

Is it possible to create a view in TSQL that references a table that cannot
be verified.
Is there some sort of override.
I need to create a view that refences a table in another db. The other db ca
nnot be available during creation.
Thanks, RobertThere's no override option for this. SQL Server need to present meta-data fo
r your view in the
system tables, and that meta-data is derived from the table(s) that the view
references. Perhaps you
can create that other database temporarily, just so that you can create the
view?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"rmg66" <rgwathney__xXx__primepro.com> wrote in message
news:%23Zc32b6FGHA.3100@.tk2msftngp13.phx.gbl...
Is it possible to create a view in TSQL that references a table that cannot
be verified.
Is there some sort of override.
I need to create a view that refences a table in another db. The other db ca
nnot be available during
creation.
Thanks, Robert

Override a foreign key constraint

A website that I'm working on has users sign in and keeps a log of the pages they go to. The log table has a foreign key in it that links to the username is the users table. I need to update the username for one of the users but the foreign key is preventing me from doing so. What is the benefit of having a foreign key like this? Can I delete it to update the username or is there a better way?

Foreign Key constraints ensure the integrity of the data is maintained. If there was no FK in place. then it would be easy to get orphaned and inconsistent data. In your example, if you just update a username to be Bob from Terry then all the records associated with Terry in the log table will now have no link back to the users record ie the Terry records will be orphaned.

Soooooo, in answer to your question, you can drop it make your update but it will throw an error when you try and recreate the FK unless you update the log records too.

You can create these constraints with a cascading updates/deletes which will filter your changes down to the child tables but in this case, it looks like its turned off.

I'd suggest just doing the following

Psuedo code:

UPDATE Log set Username = Bob WHERE username = Terry

UPDATE user set username = Bob WHERE username = Terry.

HTH!