Showing posts with label certain. Show all posts
Showing posts with label certain. Show all posts

Thursday, March 22, 2012

Check If View Exists

I'm working on a project for my class. I have to test for the existance of a certain view, and if it exists I have to delete it before recreating it. I figure it involves an IF command, and I know how to create a view. Everything in between is a blank for me. Any help would be appreciated. Thanks in advance.

An easy way to do this is to use the INFORMATION SCHEMA objects. They provide a handy way to get at the tables/views/etc inside the database..

Code Snippet

USE MyDatabase;

SELECT * FROM INFORMATION_SCHEMA.VIEWS

If you need to look for anything else inside the database, there are a bunch of others:

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

|||I really appreciate that. Thank you.

Check If View Exists

I'm working on a project for my class. I have to test for the existance of a certain view, and if it exists I have to delete it before recreating it. I figure it involves an IF command, and I know how to create a view. Everything in between is a blank for me. Any help would be appreciated. Thanks in advance.

An easy way to do this is to use the INFORMATION SCHEMA objects. They provide a handy way to get at the tables/views/etc inside the database..

Code Snippet

USE MyDatabase;

SELECT * FROM INFORMATION_SCHEMA.VIEWS

If you need to look for anything else inside the database, there are a bunch of others:

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

|||I really appreciate that. Thank you.

Check If View Exists

I'm working on a project for my class. I have to test for the existance of a certain view, and if it exists I have to delete it before recreating it. I figure it involves an IF command, and I know how to create a view. Everything in between is a blank for me. Any help would be appreciated. Thanks in advance.

An easy way to do this is to use the INFORMATION SCHEMA objects. They provide a handy way to get at the tables/views/etc inside the database..

Code Snippet

USE MyDatabase;

SELECT * FROM INFORMATION_SCHEMA.VIEWS

If you need to look for anything else inside the database, there are a bunch of others:

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

|||I really appreciate that. Thank you.

Tuesday, March 20, 2012

check if a table exists in SQL 2005

I'm trying to check if a certain table exists in a given database on a SQL 2005 Server.

I've tried numerous times without any result.

can anyone point me in the right direction?

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TableName]') AND type in (N'U'))

This was generated when i create a drop script for table.

|||

the answer is so easy that i feel emberrased that i asked it.

Thanks for the support boban

|||Don't feel embarrased -I was googling for the answer and found it in this thread.

M@.
|||

when I try to use the script code it gives me an error that sys.objects doesnt exist am I missing something here?

|||

How about just 'select * from sys.objects where name = 'tablename' and type_desc = 'USER_TABLE'

sql

check if a table exists in SQL 2005

I'm trying to check if a certain table exists in a given database on a SQL 2005 Server.

I've tried numerous times without any result.

can anyone point me in the right direction?

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TableName]') AND type in (N'U'))

This was generated when i create a drop script for table.

|||

the answer is so easy that i feel emberrased that i asked it.

Thanks for the support boban

|||Don't feel embarrased -I was googling for the answer and found it in this thread.

M@.
|||

when I try to use the script code it gives me an error that sys.objects doesnt exist am I missing something here?

|||

How about just 'select * from sys.objects where name = 'tablename' and type_desc = 'USER_TABLE'

check if a table exists in SQL 2005

I'm trying to check if a certain table exists in a given database on a SQL 2005 Server.

I've tried numerous times without any result.

can anyone point me in the right direction?

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TableName]') AND type in (N'U'))

This was generated when i create a drop script for table.

|||

the answer is so easy that i feel emberrased that i asked it.

Thanks for the support boban

|||Don't feel embarrased -I was googling for the answer and found it in this thread.

M@.
|||

when I try to use the script code it gives me an error that sys.objects doesnt exist am I missing something here?

|||

How about just 'select * from sys.objects where name = 'tablename' and type_desc = 'USER_TABLE'

check if a table exists in SQL 2005

I'm trying to check if a certain table exists in a given database on a SQL 2005 Server.

I've tried numerous times without any result.

can anyone point me in the right direction?

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TableName]') AND type in (N'U'))

This was generated when i create a drop script for table.

|||

the answer is so easy that i feel emberrased that i asked it.

Thanks for the support boban

|||Don't feel embarrased -I was googling for the answer and found it in this thread.

M@.
|||

when I try to use the script code it gives me an error that sys.objects doesnt exist am I missing something here?

|||

How about just 'select * from sys.objects where name = 'tablename' and type_desc = 'USER_TABLE'

Wednesday, March 7, 2012

check access to DB based on a systable?

I have this query to search whether a stored procedure uses a certain
text string (or whether a table is named like this text string). I use
a cursor to "scan" all the databases. It works fine except for the
error i get because i'm not a valid user for certain databases (Server:
Msg 916, Level 14, State 1, Line 1
Server user 'OSS_NT1\KSTR' is not a valid user in database 'Acis') .
This is normal because i don't have access rights to this DB.
Is there a way to limit the list of databases with the ones i do have
access to (using a systable)? The 'select name from sysdatabases'
statement unfortunately provides all the DB's.
use master
declare @.db as varchar(500)
declare @.sql as varchar(1024)
declare @.str as varchar(100)
set @.str='detail'
declare curs cursor forward_only for
select name from sysdatabases
OPEN CURS
FETCH NEXT FROM CURS INTO @.db
WHILE (@.@.fetch_status<>-1)
BEGIN
set @.sql= 'select distinct ''' + @.db + ''' as DB , case xtype when
''p'' then ''SPD'' when ''u'' then ''TAB'' when ''v'' then ''VW'' else
xtype end as Type, name from ' + @.db + '..sysobjects where ( xtype in
(''p'') and id in (select id from ' + @.db + '..syscomments where text
like ''%' + @.str + '%'')) or ( xtype in (''U'', ''V'') and name like
''%' + @.str + '%'' ) order by type, name'
execute (@.sql)
FETCH NEXT FROM CURS INTO @.db
end
CLOSE CURS
DEALLOCATE CURShave a look in syspermissions...
u should be able to do a join between sysdatabases and syspermissions
to get what u need.
Kenny wrote:
> I have this query to search whether a stored procedure uses a certain
> text string (or whether a table is named like this text string). I use
> a cursor to "scan" all the databases. It works fine except for the
> error i get because i'm not a valid user for certain databases (Server:
> Msg 916, Level 14, State 1, Line 1
> Server user 'OSS_NT1\KSTR' is not a valid user in database 'Acis') .
> This is normal because i don't have access rights to this DB.
> Is there a way to limit the list of databases with the ones i do have
> access to (using a systable)? The 'select name from sysdatabases'
> statement unfortunately provides all the DB's.
>
> use master
> declare @.db as varchar(500)
> declare @.sql as varchar(1024)
> declare @.str as varchar(100)
> set @.str='detail'
> declare curs cursor forward_only for
> select name from sysdatabases
> OPEN CURS
> FETCH NEXT FROM CURS INTO @.db
> WHILE (@.@.fetch_status<>-1)
> BEGIN
> set @.sql= 'select distinct ''' + @.db + ''' as DB , case xtype when
> ''p'' then ''SPD'' when ''u'' then ''TAB'' when ''v'' then ''VW'' else
> xtype end as Type, name from ' + @.db + '..sysobjects where ( xtype in
> (''p'') and id in (select id from ' + @.db + '..syscomments where text
> like ''%' + @.str + '%'')) or ( xtype in (''U'', ''V'') and name like
> ''%' + @.str + '%'' ) order by type, name'
> execute (@.sql)
> FETCH NEXT FROM CURS INTO @.db
> end
> CLOSE CURS
> DEALLOCATE CURS|||> have a look in syspermissions...
> u should be able to do a join between sysdatabases and syspermissions
> to get what u need.
>
Got it, all i needed was the function Has_DBacces(dbname). If 1 =>
access, if 0 => no access.

Tuesday, February 14, 2012

character(s) that cannot be stored in DB

Does any one know if there're certain character(s) that
cannot be stored in the DB which is similar to Windows
cannot have " or * etc.?
Thanks
OwenNot really. But the character repertoire is based on the collation selected for the
column/database/server.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Owen" <owen_lin@.hotmail.com> wrote in message news:12f901c4a5f1$04a6acf0$a601280a@.phx.gbl...
> Does any one know if there're certain character(s) that
> cannot be stored in the DB which is similar to Windows
> cannot have " or * etc.?
> Thanks
> Owen|||Thanks for your reply Tibor.
I am in a situation where the company that is hosting my
web site has told me that I cannot enter characters ' and
+ in the column as it will cause problem, I can enter "
however. What can you suggest that I tell them as I do
need to input those characters.
Thanks
Owen
>Not really. But the character repertoire is based on the
collation selected for the
>column/database/server.
>--
>Tibor Karaszi, SQL Server MVP
>http://www.karaszi.com/sqlserver/default.asp
>http://www.solidqualitylearning.com/
>
>"Owen" <owen_lin@.hotmail.com> wrote in message
news:12f901c4a5f1$04a6acf0$a601280a@.phx.gbl...
>> Does any one know if there're certain character(s) that
>> cannot be stored in the DB which is similar to Windows
>> cannot have " or * etc.?
>> Thanks
>> Owen|||Ask them what they mean by "it will cause problem". SQL Server can certainly handle this. Who wrote
the application you are using?
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Owen" <owen_lin@.hotmail.com> wrote in message news:35f801c4a601$fd6b9200$a501280a@.phx.gbl...
> Thanks for your reply Tibor.
> I am in a situation where the company that is hosting my
> web site has told me that I cannot enter characters ' and
> + in the column as it will cause problem, I can enter "
> however. What can you suggest that I tell them as I do
> need to input those characters.
> Thanks
> Owen
> >Not really. But the character repertoire is based on the
> collation selected for the
> >column/database/server.
> >
> >--
> >Tibor Karaszi, SQL Server MVP
> >http://www.karaszi.com/sqlserver/default.asp
> >http://www.solidqualitylearning.com/
> >
> >
> >"Owen" <owen_lin@.hotmail.com> wrote in message
> news:12f901c4a5f1$04a6acf0$a601280a@.phx.gbl...
> >> Does any one know if there're certain character(s) that
> >> cannot be stored in the DB which is similar to Windows
> >> cannot have " or * etc.?
> >>
> >> Thanks
> >>
> >> Owen|||"Owen" <owen_lin@.hotmail.com> wrote in message
news:35f801c4a601$fd6b9200$a501280a@.phx.gbl...
> Thanks for your reply Tibor.
> I am in a situation where the company that is hosting my
> web site has told me that I cannot enter characters ' and
> + in the column as it will cause problem, I can enter "
> however. What can you suggest that I tell them as I do
> need to input those characters.
My guess is they're trying to trap certain stuff to prevent SQL Injection
attacks.
However, allowing " isn't smart in that case.|||I spoke to the company that is hosting my web site and DB, although I did not
asked them in details as to what sort of problem it might cuase or have
caused in the past, but they did told me that it has been a problem in the
past where their hosting site(s) needing to store ' within SQL and have
encountered some issue.
They have asked me to seek advice on their behalf as to what can/should they
do to overcome such problem.
Many thanks
Owen
"Tibor Karaszi" wrote:
> Ask them what they mean by "it will cause problem". SQL Server can certainly handle this. Who wrote
> the application you are using?
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Owen" <owen_lin@.hotmail.com> wrote in message news:35f801c4a601$fd6b9200$a501280a@.phx.gbl...
> > Thanks for your reply Tibor.
> >
> > I am in a situation where the company that is hosting my
> > web site has told me that I cannot enter characters ' and
> > + in the column as it will cause problem, I can enter "
> > however. What can you suggest that I tell them as I do
> > need to input those characters.
> >
> > Thanks
> >
> > Owen
> >
> > >Not really. But the character repertoire is based on the
> > collation selected for the
> > >column/database/server.
> > >
> > >--
> > >Tibor Karaszi, SQL Server MVP
> > >http://www.karaszi.com/sqlserver/default.asp
> > >http://www.solidqualitylearning.com/
> > >
> > >
> > >"Owen" <owen_lin@.hotmail.com> wrote in message
> > news:12f901c4a5f1$04a6acf0$a601280a@.phx.gbl...
> > >> Does any one know if there're certain character(s) that
> > >> cannot be stored in the DB which is similar to Windows
> > >> cannot have " or * etc.?
> > >>
> > >> Thanks
> > >>
> > >> Owen
>
>|||Thanks for your reply Greg.
May I ask what sort of issue(s) might occur by allowing the use of " ?
Owen
"Greg D. Moore (Strider)" wrote:
> "Owen" <owen_lin@.hotmail.com> wrote in message
> news:35f801c4a601$fd6b9200$a501280a@.phx.gbl...
> > Thanks for your reply Tibor.
> >
> > I am in a situation where the company that is hosting my
> > web site has told me that I cannot enter characters ' and
> > + in the column as it will cause problem, I can enter "
> > however. What can you suggest that I tell them as I do
> > need to input those characters.
> My guess is they're trying to trap certain stuff to prevent SQL Injection
> attacks.
> However, allowing " isn't smart in that case.
>
>|||Oh yes, I forgot to mention the SQL Server is Traditional Chinese version,
does it make any different in this case?
"Owen" wrote:
> Thanks for your reply Tibor.
> I am in a situation where the company that is hosting my
> web site has told me that I cannot enter characters ' and
> + in the column as it will cause problem, I can enter "
> however. What can you suggest that I tell them as I do
> need to input those characters.
> Thanks
> Owen
> >Not really. But the character repertoire is based on the
> collation selected for the
> >column/database/server.
> >
> >--
> >Tibor Karaszi, SQL Server MVP
> >http://www.karaszi.com/sqlserver/default.asp
> >http://www.solidqualitylearning.com/
> >
> >
> >"Owen" <owen_lin@.hotmail.com> wrote in message
> news:12f901c4a5f1$04a6acf0$a601280a@.phx.gbl...
> >> Does any one know if there're certain character(s) that
> >> cannot be stored in the DB which is similar to Windows
> >> cannot have " or * etc.?
> >>
> >> Thanks
> >>
> >> Owen
>|||"Owen" <Owen@.discussions.microsoft.com> wrote in message
news:67D98731-28FA-4E60-8A36-6E0A116F9E91@.microsoft.com...
> I spoke to the company that is hosting my web site and DB, although I did
not
> asked them in details as to what sort of problem it might cuase or have
> caused in the past, but they did told me that it has been a problem in the
> past where their hosting site(s) needing to store ' within SQL and have
> encountered some issue.
>
The general way of handling this is use '' (two single quotes).
ie. select * from names where lastname='O''brien'
It's not clear to me what they're doing, blocking ' entirely?
> They have asked me to seek advice on their behalf as to what can/should
they
> do to overcome such problem.
> Many thanks
> Owen|||"Owen" <Owen@.discussions.microsoft.com> wrote in message
news:DB0511AF-7798-4821-A269-52F5FEFB3236@.microsoft.com...
> Oh yes, I forgot to mention the SQL Server is Traditional Chinese version,
> does it make any different in this case?
>
Depending on how their server is setup, it's possible to treat " like '
which then of course leads to SQL Injection attacks.|||> They have asked me to seek advice on their behalf as to what can/should they
> do to overcome such problem.
"I have an application that uses SQL Server, and my application has a lot of bugs in it. I.e.,
there's a problem in SQL server, is there a fix for it?"
I'm not sure I can put it simpler than above. :-)
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Owen" <Owen@.discussions.microsoft.com> wrote in message
news:67D98731-28FA-4E60-8A36-6E0A116F9E91@.microsoft.com...
> I spoke to the company that is hosting my web site and DB, although I did not
> asked them in details as to what sort of problem it might cuase or have
> caused in the past, but they did told me that it has been a problem in the
> past where their hosting site(s) needing to store ' within SQL and have
> encountered some issue.
> They have asked me to seek advice on their behalf as to what can/should they
> do to overcome such problem.
> Many thanks
> Owen
> "Tibor Karaszi" wrote:
> > Ask them what they mean by "it will cause problem". SQL Server can certainly handle this. Who
wrote
> > the application you are using?
> >
> > --
> > Tibor Karaszi, SQL Server MVP
> > http://www.karaszi.com/sqlserver/default.asp
> > http://www.solidqualitylearning.com/
> >
> >
> > "Owen" <owen_lin@.hotmail.com> wrote in message news:35f801c4a601$fd6b9200$a501280a@.phx.gbl...
> > > Thanks for your reply Tibor.
> > >
> > > I am in a situation where the company that is hosting my
> > > web site has told me that I cannot enter characters ' and
> > > + in the column as it will cause problem, I can enter "
> > > however. What can you suggest that I tell them as I do
> > > need to input those characters.
> > >
> > > Thanks
> > >
> > > Owen
> > >
> > > >Not really. But the character repertoire is based on the
> > > collation selected for the
> > > >column/database/server.
> > > >
> > > >--
> > > >Tibor Karaszi, SQL Server MVP
> > > >http://www.karaszi.com/sqlserver/default.asp
> > > >http://www.solidqualitylearning.com/
> > > >
> > > >
> > > >"Owen" <owen_lin@.hotmail.com> wrote in message
> > > news:12f901c4a5f1$04a6acf0$a601280a@.phx.gbl...
> > > >> Does any one know if there're certain character(s) that
> > > >> cannot be stored in the DB which is similar to Windows
> > > >> cannot have " or * etc.?
> > > >>
> > > >> Thanks
> > > >>
> > > >> Owen
> >
> >
> >|||They have overcome the problem within the ASP coding by using "relapce".
The issue came about as we have an admin section for our company's web site,
this is an interface where we can update the info on the site, but apparently
when a single quotation mark (') is written to the SQL via the ASP it would
cause some problem. So someone have suggested the use of "relapce" to write
two single quotation mark where one is entered, and would display it as one
single quotation mark when two singles '' is detected.
This seem to do the trick nevertheless, not sure what your thoughts are on
this?
"Owen" wrote:
> I spoke to the company that is hosting my web site and DB, although I did not
> asked them in details as to what sort of problem it might cuase or have
> caused in the past, but they did told me that it has been a problem in the
> past where their hosting site(s) needing to store ' within SQL and have
> encountered some issue.
> They have asked me to seek advice on their behalf as to what can/should they
> do to overcome such problem.
> Many thanks
> Owen
> "Tibor Karaszi" wrote:
> > Ask them what they mean by "it will cause problem". SQL Server can certainly handle this. Who wrote
> > the application you are using?
> >
> > --
> > Tibor Karaszi, SQL Server MVP
> > http://www.karaszi.com/sqlserver/default.asp
> > http://www.solidqualitylearning.com/
> >
> >
> > "Owen" <owen_lin@.hotmail.com> wrote in message news:35f801c4a601$fd6b9200$a501280a@.phx.gbl...
> > > Thanks for your reply Tibor.
> > >
> > > I am in a situation where the company that is hosting my
> > > web site has told me that I cannot enter characters ' and
> > > + in the column as it will cause problem, I can enter "
> > > however. What can you suggest that I tell them as I do
> > > need to input those characters.
> > >
> > > Thanks
> > >
> > > Owen
> > >
> > > >Not really. But the character repertoire is based on the
> > > collation selected for the
> > > >column/database/server.
> > > >
> > > >--
> > > >Tibor Karaszi, SQL Server MVP
> > > >http://www.karaszi.com/sqlserver/default.asp
> > > >http://www.solidqualitylearning.com/
> > > >
> > > >
> > > >"Owen" <owen_lin@.hotmail.com> wrote in message
> > > news:12f901c4a5f1$04a6acf0$a601280a@.phx.gbl...
> > > >> Does any one know if there're certain character(s) that
> > > >> cannot be stored in the DB which is similar to Windows
> > > >> cannot have " or * etc.?
> > > >>
> > > >> Thanks
> > > >>
> > > >> Owen
> >
> >
> >|||> So someone have suggested the use of "relapce" to write
> two single quotation mark where one is entered, and would display it as one
> single quotation mark when two singles '' is detected.
> This seem to do the trick nevertheless, not sure what your thoughts are on
> this?
The correct way to input a single quote in the SQL language is indeed to escape it with a preceding
single quote (which makes it two single quotes).
Consider using command objects and parameter object in your app, this way your database programming
interface (ADO etc) will do this for you.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Owen" <Owen@.discussions.microsoft.com> wrote in message
news:7E044AE8-4459-427F-9923-DEE984ABD117@.microsoft.com...
> They have overcome the problem within the ASP coding by using "relapce".
> The issue came about as we have an admin section for our company's web site,
> this is an interface where we can update the info on the site, but apparently
> when a single quotation mark (') is written to the SQL via the ASP it would
> cause some problem. So someone have suggested the use of "relapce" to write
> two single quotation mark where one is entered, and would display it as one
> single quotation mark when two singles '' is detected.
> This seem to do the trick nevertheless, not sure what your thoughts are on
> this?
>
> "Owen" wrote:
>> I spoke to the company that is hosting my web site and DB, although I did not
>> asked them in details as to what sort of problem it might cuase or have
>> caused in the past, but they did told me that it has been a problem in the
>> past where their hosting site(s) needing to store ' within SQL and have
>> encountered some issue.
>> They have asked me to seek advice on their behalf as to what can/should they
>> do to overcome such problem.
>> Many thanks
>> Owen
>> "Tibor Karaszi" wrote:
>> > Ask them what they mean by "it will cause problem". SQL Server can certainly handle this. Who
>> > wrote
>> > the application you are using?
>> >
>> > --
>> > Tibor Karaszi, SQL Server MVP
>> > http://www.karaszi.com/sqlserver/default.asp
>> > http://www.solidqualitylearning.com/
>> >
>> >
>> > "Owen" <owen_lin@.hotmail.com> wrote in message news:35f801c4a601$fd6b9200$a501280a@.phx.gbl...
>> > > Thanks for your reply Tibor.
>> > >
>> > > I am in a situation where the company that is hosting my
>> > > web site has told me that I cannot enter characters ' and
>> > > + in the column as it will cause problem, I can enter "
>> > > however. What can you suggest that I tell them as I do
>> > > need to input those characters.
>> > >
>> > > Thanks
>> > >
>> > > Owen
>> > >
>> > > >Not really. But the character repertoire is based on the
>> > > collation selected for the
>> > > >column/database/server.
>> > > >
>> > > >--
>> > > >Tibor Karaszi, SQL Server MVP
>> > > >http://www.karaszi.com/sqlserver/default.asp
>> > > >http://www.solidqualitylearning.com/
>> > > >
>> > > >
>> > > >"Owen" <owen_lin@.hotmail.com> wrote in message
>> > > news:12f901c4a5f1$04a6acf0$a601280a@.phx.gbl...
>> > > >> Does any one know if there're certain character(s) that
>> > > >> cannot be stored in the DB which is similar to Windows
>> > > >> cannot have " or * etc.?
>> > > >>
>> > > >> Thanks
>> > > >>
>> > > >> Owen
>> >
>> >
>> >

character(s) that cannot be stored in DB

Does any one know if there're certain character(s) that
cannot be stored in the DB which is similar to Windows
cannot have " or * etc.?
Thanks
Owen
Not really. But the character repertoire is based on the collation selected for the
column/database/server.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Owen" <owen_lin@.hotmail.com> wrote in message news:12f901c4a5f1$04a6acf0$a601280a@.phx.gbl...
> Does any one know if there're certain character(s) that
> cannot be stored in the DB which is similar to Windows
> cannot have " or * etc.?
> Thanks
> Owen
|||Thanks for your reply Tibor.
I am in a situation where the company that is hosting my
web site has told me that I cannot enter characters ' and
+ in the column as it will cause problem, I can enter "
however. What can you suggest that I tell them as I do
need to input those characters.
Thanks
Owen

>Not really. But the character repertoire is based on the
collation selected for the
>column/database/server.
>--
>Tibor Karaszi, SQL Server MVP
>http://www.karaszi.com/sqlserver/default.asp
>http://www.solidqualitylearning.com/
>
>"Owen" <owen_lin@.hotmail.com> wrote in message
news:12f901c4a5f1$04a6acf0$a601280a@.phx.gbl...[vbcol=seagreen]
|||Ask them what they mean by "it will cause problem". SQL Server can certainly handle this. Who wrote
the application you are using?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Owen" <owen_lin@.hotmail.com> wrote in message news:35f801c4a601$fd6b9200$a501280a@.phx.gbl...[vbcol=seagreen]
> Thanks for your reply Tibor.
> I am in a situation where the company that is hosting my
> web site has told me that I cannot enter characters ' and
> + in the column as it will cause problem, I can enter "
> however. What can you suggest that I tell them as I do
> need to input those characters.
> Thanks
> Owen
> collation selected for the
> news:12f901c4a5f1$04a6acf0$a601280a@.phx.gbl...
|||"Owen" <owen_lin@.hotmail.com> wrote in message
news:35f801c4a601$fd6b9200$a501280a@.phx.gbl...
> Thanks for your reply Tibor.
> I am in a situation where the company that is hosting my
> web site has told me that I cannot enter characters ' and
> + in the column as it will cause problem, I can enter "
> however. What can you suggest that I tell them as I do
> need to input those characters.
My guess is they're trying to trap certain stuff to prevent SQL Injection
attacks.
However, allowing " isn't smart in that case.
|||I spoke to the company that is hosting my web site and DB, although I did not
asked them in details as to what sort of problem it might cuase or have
caused in the past, but they did told me that it has been a problem in the
past where their hosting site(s) needing to store ' within SQL and have
encountered some issue.
They have asked me to seek advice on their behalf as to what can/should they
do to overcome such problem.
Many thanks
Owen
"Tibor Karaszi" wrote:

> Ask them what they mean by "it will cause problem". SQL Server can certainly handle this. Who wrote
> the application you are using?
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Owen" <owen_lin@.hotmail.com> wrote in message news:35f801c4a601$fd6b9200$a501280a@.phx.gbl...
>
>
|||Thanks for your reply Greg.
May I ask what sort of issue(s) might occur by allowing the use of " ?
Owen
"Greg D. Moore (Strider)" wrote:

> "Owen" <owen_lin@.hotmail.com> wrote in message
> news:35f801c4a601$fd6b9200$a501280a@.phx.gbl...
> My guess is they're trying to trap certain stuff to prevent SQL Injection
> attacks.
> However, allowing " isn't smart in that case.
>
>
|||Oh yes, I forgot to mention the SQL Server is Traditional Chinese version,
does it make any different in this case?
"Owen" wrote:

> Thanks for your reply Tibor.
> I am in a situation where the company that is hosting my
> web site has told me that I cannot enter characters ' and
> + in the column as it will cause problem, I can enter "
> however. What can you suggest that I tell them as I do
> need to input those characters.
> Thanks
> Owen
> collation selected for the
> news:12f901c4a5f1$04a6acf0$a601280a@.phx.gbl...
>
|||"Owen" <Owen@.discussions.microsoft.com> wrote in message
news:67D98731-28FA-4E60-8A36-6E0A116F9E91@.microsoft.com...
> I spoke to the company that is hosting my web site and DB, although I did
not
> asked them in details as to what sort of problem it might cuase or have
> caused in the past, but they did told me that it has been a problem in the
> past where their hosting site(s) needing to store ' within SQL and have
> encountered some issue.
>
The general way of handling this is use '' (two single quotes).
ie. select * from names where lastname='O''brien'
It's not clear to me what they're doing, blocking ' entirely?

> They have asked me to seek advice on their behalf as to what can/should
they
> do to overcome such problem.
> Many thanks
> Owen
|||"Owen" <Owen@.discussions.microsoft.com> wrote in message
news:DB0511AF-7798-4821-A269-52F5FEFB3236@.microsoft.com...
> Oh yes, I forgot to mention the SQL Server is Traditional Chinese version,
> does it make any different in this case?
>
Depending on how their server is setup, it's possible to treat " like '
which then of course leads to SQL Injection attacks.