Showing posts with label code. Show all posts
Showing posts with label code. Show all posts

Wednesday, March 28, 2012

no external connections are permitted while trying to connect to SQL server

ok so this is my code:

private void iDListBox_SelectedIndexChanged(object sender, EventArgs e)

{

string connectionString = GetConnectionString();

using (SqlConnection connection = new SqlConnection(connectionString))

{

SqlCommand cmd = new SqlCommand("SELECT * FROM Table1 WHERE Naam=@.Naam", connection);

cmd.Parameters.AddWithValue("@.Naam", iDListBox.SelectedValue);

connection.Open();

SqlDataReader reader = cmd.ExecuteReader();

if (reader.Read())

{

naamTextBox.Text = reader.GetString(1);

}

reader.Dispose();

connection.Dispose();

}

}

static private string GetConnectionString()

{

return "Data Source=(local);Initial Catalog=AdventureWorks;"

+ "Integrated Security=SSPI;";

}

but when I change the selected index of the listbox, then this error comes up:

System.Data.SqlClient.SqlException was unhandled
Message="An error occured while setting up a connection with the server. At making a connection with SQL server 2005, this jamming is possibly caused by the fact that at the standardinstitutions of SQL server no external connections have been permitted (provider: Provider of named pipes, error: 40 - no connection with SQL could open server)"

If the error sounds a bit weird, sry I tried to translate as most of my errors come in my language

someone knows what the problem is and a solution to it?

(btw sry if this is in the wrong part of the sql forum, but there are so much parts, I didn't know which to choose lol Stick out tongue)

thx in advance

Please see http://blogs.msdn.com/sql_protocols/archive/2007/03/31/named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server.aspx to see if any of the suggestions solves your case.

Jimmy

Monday, March 26, 2012

No Debugging and logging when a single script task is executed

Hi,

I cannot execute a script task in the VBA code window.

I cannot debug or log if I run a single script task from the right click Execute Task .

Every time I have to run the entire package in order to be able to debug.

What am I missing?

appreciate a help.

Gulden

try disabling all the other tasks and/or containers except the script task. then, execute the package.

|||Thank You.. I guess it is the only way..|||

Gulden wrote:

Thank You.. I guess it is the only way..

If memory serves correctly, yes, it IS the only way.

We hope this will change in the future. It certainly SHOULD be changed!

-Jamie

Monday, March 12, 2012

NextDay

Hello everybody?

Another issue has cropped up in my Oracle to SQL Svr migration. Can anybody suggest the equivalent code for the Oracle NEXT_DAY function?

Here is a sample of how Oracle NEXT_DAY function works...

SELECT NEXT_DAY(sysdate, 'Sunday') from dual ;

Result:

NEXT_DAY
---
12-DEC-04

where sysdate is Oracle for GetDate() of SQL Svr. Forget about "from dual". So, what NEXT_DAY is doing is that it is returning the next coming date on which a Sunday will fall, if sysdate = 07 Dec 2004.

Any help will be highly appreciated. ThxYou'll have to write this youself, as there is no immediate equivalent.
You can pretty easily create a user-defined function that exactly mimics oracle NEXT_DAY()

You would have to use the SQL function datename(weekday, date)
and the SQL function dateadd(day, 1, date).
Loop round a max of seven (six?) times using dateadd to add a day to your date, and then using datename to get the day description which you could then compare with your input parameter. return the appropraite date when a match is found.

HTH, but I ain't coding it for you :-)

Bill|||Here is a non-looping algorithm:

declare @.TargetDay int
set @.TargetDay = 1 --Sunday
select dateadd(d, (@.TargetDay + 7-datepart(dw, getdate())) % 7, getdate())

TargetDay must be supplied as an integer, according to the settings of your @.@.DATEFIRST property. Normally, Sunday = 1, Monday = 2, etc.

Also, this returns 0 if the today is the TargetDay. Not sure exactly what you wanted in that case...|||Thx a lot lindman and bill..

Next_run_time and next_run_date of sysjobschedules

I have written some code to query the next_run_time and next_run_date of the sysjobschedules table. It works well with the exception that when a new schedule is created or an existing one is changed, these two columns are set to zero. They will eventually be initialized to the appropriate values but that may take a while. That means that the code will not work until then.

Is there a way to FORCE the initialization of the two columns ?How does your code looks like?
Tried initializing those 2 values in the code itself?|||The code is simply selecting the two columns into variables and then do further processing.

The problem is the two columns (next_run_date and next_run_time) of sysjobschedules table are set to zero whenever a new schedule is created or changed. You can try it yourselef.

Create a job (xxxxx) with a schedule.

select a.name, b.name,next_run_date, next_run_time from msdb..sysjobs a inner join msdb..sysjobschedules b
on a.job_id=b.job_id
where a.name='xxxxx'

and you will see those two columns are zeros.

However, after a while they will updated to the appropriate values by SQL.

My question, how do we force SQL to update these two columns immediately? It seems SQL keeps them in cache somewhere and periodically updates the sysjobschedules table.|||True, what you said is right.

I believe as soon as the job finishes the execution these values will be updated internally and only with manual updation you can set other values if required.

May refer to book 'Inside SQL Server 2000' by Kalen Daleney.

Friday, March 9, 2012

Newsgroup for attachments?

Is there a newsgroup where we can post file attachements (for code examples,
rdl files, etc.)?
Thank you,
--
Alain Quesnel
alainsansspam@.logiquel.com
www.logiquel.comOn Nov 5, 10:16 pm, "Alain Quesnel" <alainsanss...@.logiquel.com>
wrote:
> Is there a newsgroup where we can post file attachements (for code examples,
> rdl files, etc.)?
> Thank you,
> --
> Alain Quesnel
> alainsanss...@.logiquel.com
> www.logiquel.com
This is by far the largest, highest traffic Reporting Services
newsgroup (and has the most responses and participation); however, 3
others have the option to upload files (and I'm sure there are others
as well):
http://groups.google.com/group/SQL-SERVER-REPORTING-SERVICES
http://groups.google.com/group/RS2005
http://groups.google.com/group/ReportingServices
Hope this helps.
Regards,
Enrique Martinez
Sr. Software Consultant|||I take it Microsoft doesn't have any newsgroups that accept attachments?
Thank you,
--
Alain Quesnel
alainsansspam@.logiquel.com
www.logiquel.com
"EMartinez" <emartinez.pr1@.gmail.com> wrote in message
news:1194323747.519601.245000@.57g2000hsv.googlegroups.com...
> On Nov 5, 10:16 pm, "Alain Quesnel" <alainsanss...@.logiquel.com>
> wrote:
>> Is there a newsgroup where we can post file attachements (for code
>> examples,
>> rdl files, etc.)?
>> Thank you,
>> --
>> Alain Quesnel
>> alainsanss...@.logiquel.com
>> www.logiquel.com
>
> This is by far the largest, highest traffic Reporting Services
> newsgroup (and has the most responses and participation); however, 3
> others have the option to upload files (and I'm sure there are others
> as well):
> http://groups.google.com/group/SQL-SERVER-REPORTING-SERVICES
> http://groups.google.com/group/RS2005
> http://groups.google.com/group/ReportingServices
> Hope this helps.
> Regards,
> Enrique Martinez
> Sr. Software Consultant
>

NEWSEQUENTIALID sample code

We're currently converting the database of our asset management system to a SQL2005-database. The SQL2000 database uses an INT32 as the primary key with a clustered index on that column on most tables. Needless to say that the current environment is not ideal for replication, so we're investigating the use of GUIDs as primary keys.

We know the usual recommendations as far as GUIDs are concerned (4 times bigger, slower, not good for clustered indexes, yet better for replication). However, on one of the ascend-program training days one of my colleagues talked to one of the instructors and that person suggested that the use and performance of GUIDs is significantely improved in SQL2005 and that they have become the preferred datatype for primary keys if the database is used in replication.

I have tried to find some information about how GUIDs are improved in SQL2005 but I don't find any documents containing anything relevant. The only thing I've found is the documentation of the NEWSEQUENTIALID function which doesn't really tell me much. It just looks like this function improves the performance during an insert if a GUID is used on a clustered index. I have noticed for example that SharePoint only uses GUIDs for most tables; so the performance should be all that bad.

So I was wondering:

1. has the performance of GUIDs improved?

2. are there new suggestions concerning the datatype of the primary key column if the database might be used in a merge replication environment (all sites can do modifications) on SQL2005?

3. what about the performance of NEWSEQUENTIALID? Is there a bigger chance of running into duplicates using NEWSEQUENTIALID?

Regards,

Michael

NEWSEQUENTIALID is derived based on several hashes, one of which is the network card. Since no two network cards are identical, duplicates should not occur. However should you remove your network card, there's a slight chance you can get the same value as another machine whose network card has been removed, but this is highly unlikely.

Since NEWSEQUENTIALID values are incrementing as they're created, clustered index performance should improve as they'll be inserted ascending and in sort order. You also have less page splits, thus less fragmentation.

So, is NEWSEQUENTIALID a good candidate for a primary key? NEWSEQUENTIALID can only be used as a default constraint. that means if this is your primary key, and you have to update it, you can only use NEWID as the new value. Or, you can do delete/insert. If you do a lot of updates to your primary key, you'll be doing a lot of page splits introducing fragmentation.

|||How does the program get the NEWSEQUENTIALID value? In other words, the code has:
sqlCmd = "insert ..."
ExecuteNonQuery
If you have foreign key references, you'll need to retrieve your NEWSEQUENTIALID value and pass it as the foreign key value into the child table(s).|||Just use the OUTPUT clause of the INSERT statement.|||

For a parent child relationship, you can do this:

CREATE TABLE Employee(
EmployeeID uniqueidentifier NOT NULL DEFAULT NEWSEQUENTIALID(),
EmployeeName nchar(10) NOT NULL
)

insert Employee (EmployeeName)
output Inserted.EmployeeID
values ('Ima Person')

The OUTPUT clause essentially works like a SELECT statement. You can retrieve multiple values with an OUTPUT clause.

Alternatively, you may wish to use this syntax for CREATE TABLE:

CREATE TABLE Employee(
EmployeeID uniqueidentifier NOT NULL DEFAULT NEWSEQUENTIALID() ROWGUIDCOL,
EmployeeName nchar(10) NOT NULL
)

Wednesday, March 7, 2012

NEWID() Generation Code

hi,
i want the code for newid() in sqlserver 2000 , if anyone knows about it please send me the code.I need it for my customised application . It will be of great help.
Could you explain what exactly you're trying to achieve? I can guarantee you no one will send you the code.|||If your customized application is managed code, Guid.NewGuid() generates a new GUID.

If your app is native, HRESULT CoCreateGUID(GUID *pguid) does the same thing.

newby - AUTOINCREMENT problem.

Hi,

I'm enclosed a snippet of test code which highlights my problem. The Stored
procedure insertValue should insert text into the parent, then insert other
text into the child table but the 2 tables should auto increment in sync
(i.e. so that they both end up with the same id numbers). I've tried taking
the auto increment out of the child table but then I don't know how to get
the right parent id into the child table.

Any advice appreciated - this is my first database, so I'm just in the
learning process really. Code follows:

CREATE TABLE Parent
(id INTEGER DEFAULT AUTOINCREMENT,
parenttext VARCHAR(16),
PRIMARY KEY (id))!

CREATE TABLE Child
(childID INTEGER INTEGER DEFAULT AUTOINCREMENT,
childtext VARCHAR(16),
FOREIGN KEY (childid) REFERENCES Parent(id),
PRIMARY KEY (childID))!

CREATE PROCEDURE insertValues(in p VARCHAR(16), in c VARCHAR(16))
BEGIN
insert into parent (parenttext) values (p);
insert into child (childtext) values (c);
END!

call insertValues('from parent', 'from child')!
select * from parent, child where parent.id = child.childid!In message <436cefc6$1_3@.mk-nntp-2.news.uk.tiscali.com>, Mary Walker
<123@.123.com> writes
>Hi,
>I'm enclosed a snippet of test code which highlights my problem. The Stored
>procedure insertValue should insert text into the parent, then insert other
>text into the child table but the 2 tables should auto increment in sync
>(i.e. so that they both end up with the same id numbers). I've tried taking
>the auto increment out of the child table but then I don't know how to get
>the right parent id into the child table.
>Any advice appreciated - this is my first database, so I'm just in the
>learning process really. Code follows:

OK. The first piece of advice is don't rely on the autonumber to return
any particular value. There are ways that the values in the two tables
could get out of sync and it would be a PITA to fix.

There are two options that I could suggest.

One is that you create the parent record and then take the autonumber
value from there and explicitly insert it into the child table. Don't
use an autonumber in child table, use a simple integer instead. This is
the way I recommend that you do it.

The second method has limited applicability but can make things easier.
First redesign your child table with an integer key. Then create a query
that links the two tables. You can now update the query instead of
updating the two tables separately.

--
Bernard Peek
London, UK. DBA, Manager, Trainer & Author.|||>> this is my first database, so I'm just in the learning process really. <<

Get a book on RDBMS and learn why an auto-increment can NEVER be a
relational key. Learn why a table name should be a collective or
plural name (unless there is only one row in the table). Learn way
"id" is too vague to be data element name. Learn why camelCase is a
bitch to read --hint: where does your eye jump when you see an
Uppercase letter?

I know you want to have a "Magical Universal Key" that will solve all
your design problems, without having to really think or learn anything.
What is your **real key** in your **real** problem?

Going to a Newsgroup to get what usually takes a few YEARS of college
and experience does not work.|||"--CELKO--" <jcelko212@.earthlink.net> wrote in message
news:1131243682.809956.301200@.g49g2000cwa.googlegr oups.com...
>>> this is my first database, so I'm just in the learning process really.
>>> <<
> Get a book on RDBMS and learn why an auto-increment can NEVER be a
> relational key. Learn why a table name should be a collective or
> plural name (unless there is only one row in the table). Learn way
> "id" is too vague to be data element name. Learn why camelCase is a
> bitch to read --hint: where does your eye jump when you see an
> Uppercase letter?
> I know you want to have a "Magical Universal Key" that will solve all
> your design problems, without having to really think or learn anything.
> What is your **real key** in your **real** problem?
> Going to a Newsgroup to get what usually takes a few YEARS of college
> and experience does not work.

LOL. Thanks very much you for reply. I have actually learnt a lot by
simply reading your reply - but I'll buy the book anyway :-)|||In your book 'sql for smarties' you have an example with a table named
'Warehouse' - if you where to follow your own naming standards then it
should be called 'Warehouses'.

'id' is fine within the context of the table, if the column belongs to the
table 'Child' then its obviously Child.id.

What key would you use for a message board? Would you still key it on
subject and posting date or like the rest of us and how NNTP works, create a
guid with the domain?

The auto-number (IDENTITY property) is usually used as a artificial (or
surrogate) key, there is no such thing as a relational key - I think you
mean 'natural key', see: http://en.wikipedia.org/wiki/Natural_key.

Quoting from that aritcle...

"
The main disadvantage of choosing a natural key is that it may need to
change if your business requirements change. For example, if you have chosen
CustomerNumber as the primary key for a customer, and, subsequently,
CustomerNumber becomes alphanumeric instead of numeric, then as well as
changing the type of the column, you will need to make changes to all other
tables where CustomerNumber is used as a foreign key.

Retrieved from "http://en.wikipedia.org/wiki/Natural_key"

"

--
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials

"--CELKO--" <jcelko212@.earthlink.net> wrote in message
news:1131243682.809956.301200@.g49g2000cwa.googlegr oups.com...
>>> this is my first database, so I'm just in the learning process really.
>>> <<
> Get a book on RDBMS and learn why an auto-increment can NEVER be a
> relational key. Learn why a table name should be a collective or
> plural name (unless there is only one row in the table). Learn way
> "id" is too vague to be data element name. Learn why camelCase is a
> bitch to read --hint: where does your eye jump when you see an
> Uppercase letter?
> I know you want to have a "Magical Universal Key" that will solve all
> your design problems, without having to really think or learn anything.
> What is your **real key** in your **real** problem?
> Going to a Newsgroup to get what usually takes a few YEARS of college
> and experience does not work.|||Hi Mary,

The SCOPE_IDENTITY() will return the last inserted IDENTITY value for that
connection.

insert into parent (parenttext) values (p);
print scope_identity() -- gives the id from parent

insert into child (childtext) values (c);
print scope_identity() -- gives id from child

Does that help?

Tony.

--
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials

"Mary Walker" <123@.123.com> wrote in message
news:436cefc6$1_3@.mk-nntp-2.news.uk.tiscali.com...
> Hi,
> I'm enclosed a snippet of test code which highlights my problem. The
> Stored procedure insertValue should insert text into the parent, then
> insert other text into the child table but the 2 tables should auto
> increment in sync (i.e. so that they both end up with the same id
> numbers). I've tried taking the auto increment out of the child table but
> then I don't know how to get the right parent id into the child table.
> Any advice appreciated - this is my first database, so I'm just in the
> learning process really. Code follows:
> CREATE TABLE Parent
> (id INTEGER DEFAULT AUTOINCREMENT,
> parenttext VARCHAR(16),
> PRIMARY KEY (id))!
> CREATE TABLE Child
> (childID INTEGER INTEGER DEFAULT AUTOINCREMENT,
> childtext VARCHAR(16),
> FOREIGN KEY (childid) REFERENCES Parent(id),
> PRIMARY KEY (childID))!
> CREATE PROCEDURE insertValues(in p VARCHAR(16), in c VARCHAR(16))
> BEGIN
> insert into parent (parenttext) values (p);
> insert into child (childtext) values (c);
> END!
> call insertValues('from parent', 'from child')!
> select * from parent, child where parent.id = child.childid!

Newbie's Last Question

Current code is below:
||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||
INSERT INTO FORUM_ALLOWED_MEMBERS
(
Member_ID,
Forum_ID
)
SELECT
FORUM_MEMBERS.Member_ID, FORUM_FORUM.Forum_ID FROM FORUM_MEMBERS
INNER JOIN FORUM_FORUM ON FORUM_FORUM.F_SUBJECT LIKE '%' + FORUM_MEMBERS.M_M
ARSTATUS + '%'
WHERE ISNULL(FORUM_MEMBERS.M_MARSTATUS,'') <> '' AND
NOT EXISTS(SELECT NULL FROM FORUM_ALLOWED_MEMBERS A
WHERE A.Member_ID = FORUM_MEMBERS.Member_ID AND
A.Forum_ID = FORUM_FORUM.Forum_ID) AND
EXISTS (SELECT FORUM_MEMBERS.M_DATE WHERE M_DATE >= 20050322000000)
||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||
F_SUBJECT Values = ... "147. BlaBla" "148. BlaBla" "149. BlaBla" "150. BlaBl
a" .......
F_MARSTATUS Values = ... "147" "148" 149" "150" "151" "152" "153" ........
Current code add members to forum which subject is like member's m_marstatus
value.
How to add members to forums which subject contains m_marstatus value's -3 a
nd +3.
For example M_MARSTATUS = 150, member will be allowed by forums between "147
. BlaBla" and "153. BlaBla"
Can i use 7 different inner joins to do thissuch as:
INNER JOIN FORUM_FORUM ON FORUM_FORUM.F_SUBJECT LIKE '%' + FORUM_MEMBERS.M_M
ARSTATUS + '%'
INNER JOIN FORUM_FORUM ON FORUM_FORUM.F_SUBJECT LIKE '%' + FORUM_MEMBERS.M_M
ARSTATUS -3 + '%'
INNER JOIN FORUM_FORUM ON FORUM_FORUM.F_SUBJECT LIKE '%' + FORUM_MEMBERS.M_M
ARSTATUS -2 + '%'
etc.I'm sorry to say that you are now experiencing the difficulties of coding
against a poorly designed database schema (structure) . The first thing to
do would be to redesign the tables so they are at least in "3rd Normal form"
.
If you don't know what that means, read up on it a bt...
Your immediate problem is caused by having violated one of the first rules
of database normalization, that is of putting more than one piece of
information into a single column. Each attribute, or aspect about a "thing"
should be in it's own column. You have Marital Status, and Subject mixed
together in one column. Then, you also have multiple individual data
elements of the SAME type in that single column. If you fix these issues yo
u
will find the coding problem you are facing will just go away.
"LacOniC" wrote:

> Current code is below:
> ||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||
> INSERT INTO FORUM_ALLOWED_MEMBERS
> (
> Member_ID,
> Forum_ID
> )
> SELECT
> FORUM_MEMBERS.Member_ID, FORUM_FORUM.Forum_ID FROM FORUM_MEMBERS
> INNER JOIN FORUM_FORUM ON FORUM_FORUM.F_SUBJECT LIKE '%' + FORUM_MEMBERS.M
_MARSTATUS + '%'
> WHERE ISNULL(FORUM_MEMBERS.M_MARSTATUS,'') <> '' AND
> NOT EXISTS(SELECT NULL FROM FORUM_ALLOWED_MEMBERS A
> WHERE A.Member_ID = FORUM_MEMBERS.Member_ID AND
> A.Forum_ID = FORUM_FORUM.Forum_ID) AND
> EXISTS (SELECT FORUM_MEMBERS.M_DATE WHERE M_DATE >= 20050322000000)
> ||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||
> F_SUBJECT Values = ... "147. BlaBla" "148. BlaBla" "149. BlaBla" "150. Bla
Bla" .......
> F_MARSTATUS Values = ... "147" "148" 149" "150" "151" "152" "153" ......
.
> Current code add members to forum which subject is like member's m_marstat
us value.
> How to add members to forums which subject contains m_marstatus value's -3
and +3.
> For example M_MARSTATUS = 150, member will be allowed by forums between "1
47. BlaBla" and "153. BlaBla"
> Can i use 7 different inner joins to do thissuch as:
> INNER JOIN FORUM_FORUM ON FORUM_FORUM.F_SUBJECT LIKE '%' + FORUM_MEMBERS.M
_MARSTATUS + '%'
> INNER JOIN FORUM_FORUM ON FORUM_FORUM.F_SUBJECT LIKE '%' + FORUM_MEMBERS.M
_MARSTATUS -3 + '%'
> INNER JOIN FORUM_FORUM ON FORUM_FORUM.F_SUBJECT LIKE '%' + FORUM_MEMBERS.M
_MARSTATUS -2 + '%'
> etc.
>
>|||This is Snitz Forum Database. If i edit database structure, i get more probl
ems. (For example when i update
forum version)
"You have Marital Status, and Subject mixed together in one column. "
Didn't understand this one. They are in different tables and columns.
Thank you.|||In your first post, you said...
F_SUBJECT Values = ... "147. BlaBla" "148. BlaBla" "149. BlaBla" "150.
BlaBla"
I assumed the numeric values are Marital Status, and the "BlaBla" (based on
the column name "F_SUBJECT"), have something to do with, Subjects? And thi
s
is all in the same column, no?
"LacOniC" wrote:

> This is Snitz Forum Database. If i edit database structure, i get more
problems. (For example when i update
> forum version)
> "You have Marital Status, and Subject mixed together in one column. "
> Didn't understand this one. They are in different tables and columns.
> Thank you.
>
>|||Probably my mistake. Column values are such as below:
F_SUBJECT
...
147. BlaBla
148. BlaBla
150. BlaBla
...
M_MARSTATUS
...
147
148
149
...
M_MARSTATUS column holds an user information, F_SUBJECT column holds forum s
ubject. They are relative but not
same. So i use LIKE.
"CBretana" <cbretana@.areteIndNOSPAM.com> wrote in message
news:4A0BFEA5-5996-4442-A411-BEFB84A611FA@.microsoft.com...
> In your first post, you said...
> F_SUBJECT Values = ... "147. BlaBla" "148. BlaBla" "149. BlaBla" "150.
> BlaBla"
> I assumed the numeric values are Marital Status, and the "BlaBla" (based o
n
> the column name "F_SUBJECT"), have something to do with, Subjects? And t
his
> is all in the same column, no?
> "LacOniC" wrote:
>
update|||If F_Subject contains...
147. BlaBla
148. BlaBla
150. BlaBla
What is the value "147" in the first row above represent? Is it a Subject?
If it is some Subject, you can't link it (using LIKE) to the values in the
M_MARSTATUS
column. If it IS Marital Status, then it should be in it's own column as a
foreign Key, NOT concatenated wit hSubject data in the F_SUBJET Column.
"LacOniC" wrote:

> Probably my mistake. Column values are such as below:
> F_SUBJECT
> ...
> 147. BlaBla
> 148. BlaBla
> 150. BlaBla
> ...
> M_MARSTATUS
> ...
> 147
> 148
> 149
> ...
> M_MARSTATUS column holds an user information, F_SUBJECT column holds forum
subject. They are relative but not
> same. So i use LIKE.
>
> "CBretana" <cbretana@.areteIndNOSPAM.com> wrote in message
> news:4A0BFEA5-5996-4442-A411-BEFB84A611FA@.microsoft.com...
> update
>
>|||Oh no. I don't hold marital status values in that column or anywhere else. I
use that column to hold user's
sh information.
If user belongs to "150. period of school", he should see that period and ot
hers that is closed his period.
(147,148,149,151,152,153).
With query that i wrote in first message, user just see 150.|||If you don't "hold marital status values in that column or anywhere else"...
Then how can you be joining this column (FORUM_FORUM.F_SUBJECT), with the
FORUM_MEMBERS.M_MARSTATUS column? If the numbers in this column are NOT
marital statuses, then what is this join doing '
From your original post...
FROM FORUM_MEMBERS
INNER JOIN FORUM_FORUM ON
FORUM_FORUM.F_SUBJECT LIKE '%' +
FORUM_MEMBERS.M_MARSTATUS + '%'
"LacOniC" wrote:

> Oh no. I don't hold marital status values in that column or anywhere e
lse. I use that column to hold user's
> sh information.
> If user belongs to "150. period of school", he should see that period
and others that is closed his period.
> (147,148,149,151,152,153).
> With query that i wrote in first message, user just see 150.
>
>|||I wrote what column includes which value. I didn't say MaritalStatus cloumn
is empty. It just doesn't hold
what it says. It holds numbers as 150. In fact i can't say what join is doin
g there, lol. But it works very
well. =)|||Laconic,
Well if it works, then the value in there must mean something... Your
first task, before anyone can help you, (including yourself) is t ofind out
what is in the database, (Tables and Columns) and understand what the query
is supposed to be doing, and what it is doing...
That includes knowing, and understanding, the data that is in the database.
Until you do, you really shouldn't even be messing with it. If you're the
DBA, your first task should be to hire someone who knows enough about
database technology to do that. I say that reluctantlly, but, based on your
comments in this thread, it seems that you have a great deal to learn about
SQL and RDBMS technology in general, before your skills will be at the level
necessary to do what needs doing on this system.
"LacOniC" wrote:

> I wrote what column includes which value. I didn't say MaritalStatus c
loumn is empty. It just doesn't hold
> what it says. It holds numbers as 150. In fact i can't say what join is do
ing there, lol. But it works very
> well. =)
>
>