creating a foreign key


I use phpmyadmin to handle the db.

I wrote a query to add a foreign key in an existing table, despite getting a success message that the query was completed,
I cannot find an indication that a foreign key was indeed created.

I mean, phpmyadmin seems not provide info saying for example "this column is the foreign key" as the case is when a column is the primary key.

It does not say of course "this column is the primary key", but instead it highlights the word primary.

I do not see an similar indication about foreign keys.

The only thing maybe that gives the info i want is this "Relation view" option-I am not sure though.
Posted On: Sunday 30th of December 2012 10:26:54 PM Total Views:  191
View Complete with Replies

RELATED TOPICS OF Microsoft SQL Server PROGRAMMING LANGUAGE




Cursor update creating nulls

So I've created a bit of code to remove some virus garbage that's been plaguing some of my clients, but it seems since I've tried using a cursor to streamline the process a bit it's just filling in the fields with nulls. Code: use db7021 go select * from products go declare @desc varchar(max) declare @virus varchar(128) set @virus = '' declare @start int declare @end int declare thecursor CURSOR LOCAL SCROLL_LOCKS for select cdescription from products where cdescription like ('%' + @virus + '%') for update of cdescription open thecursor fetch next from thecursor into @desc while @@FETCH_STATUS = 0 begin print @desc set @start = charindex(@virus, @desc) set @end = @start + len(@virus) print cast(@start as char) + ', ' + cast(@end as char) set @desc = left(@desc, @start - 1) + right(@desc, len(@desc)-@end+1) update products set cdescription = @desc where current of thecursor fetch next from thecursor into @desc end close thecursor deallocate thecursor select * from products go Which produces the output: Code: id cname cdescription ----------- ----------- ---------------------------------------------------------------------------------------- 1 banana sometext 0.962398 2 apple sometext 1.9248 3 lolcat sometext 2.88719 4 cheezburgr sometext 3.84959 (4 row(s) affected) sometext 0.962398 41 , 89 (1 row(s) affected) sometext 1.9248 41 , 89 (1 row(s) affected) sometext 2.88719 41 , 89 (1 row(s) affected) sometext 3.84959 41 , 89 (1 row(s) affected) id cname cdescription ----------- ------------ ------------ 1 banana NULL 2 apple NULL 3 lolcat NULL 4 cheezburgr NULL (4 row(s) affected) I trimmed out alot of whitespace from the results for the sake of readability, but aside from that this is everything I've got. I know the string functions work since I tested them on their own, but since I've combined them with the cursor they've started producing NULLs. Maybe I've missed something in the syntax for cursors
VIEWS ON THIS POST

94

Posted on:

Thursday 25th October 2012
View Replies!

Bigint type primary key

I'm using Sql Server 2000/7 for my projects. How to handle the situation if a primary key (a field set as identity) of type bigint gives an overflow problem Is there any way to reuse identities if a primary key field is set as identity from the database settings (we can do this if we donot set the primary key field as identity from the datbase and handle it from front end) please help
VIEWS ON THIS POST

57

Posted on:

Friday 26th October 2012
View Replies!

Code for creating a table in SQL from external source

I'm looking to create a table in SQL using data from the as/400. I need some code that extracts it from as/400 using odbc and I need it to loop and create that table every minute. The file its retrieving is a live file but not very large.. I need to basically poll the data. Does anyone have code for something like this..
VIEWS ON THIS POST

231

Posted on:

Friday 26th October 2012
View Replies!

In over my head!!

I am installing a retail management system at my current job. It uses sql server 2005, to build it's data base. Unfortunetly I can't get past the log in page. I know is that I think my server name is your-4dacd0ea75. I don't know the default username and password. I might add that this computer is not running any type of network to any other computer. This will be it's own server. Oh and I know nothing of SQL servers so if you answer please do it as if you were talking to a 12 year old...
VIEWS ON THIS POST

43

Posted on:

Wednesday 7th November 2012
View Replies!

Problem with a complex query

Hi guyz, I guess there is a very simple solution to this but i cant think logically no more.. i have gone alllll blank i would really appreciate it if someone can help me real quick. I run a query in vbscript that fills up my recordset from multiple tables. Its actually gettin userid, firstname and email address of users:::: SELECT PersonalInfo.firstname AS Expr2, PersonalInfo.email AS Expr3, SurveyAns.answer AS Expr4 FROM PersonalInfo INNER JOIN SurveyAns ON PersonalInfo.userid = SurveyAns.userid INNER JOIN SurveyQue ON SurveyAns.surveyid = SurveyQue.surveyid AND SurveyAns.questionid = SurveyQue.questionid where (SurveyAns.answer LIKE '%" & value11 & "%' AND SurveyQue.name='" & value12 & "') the variables value11 and value12 come from a dynamic drop down lists. Now i need an option to be able to further narrow down that is filter from this recordset set of usernames, and user ids with SurveyAns.answer = something and SurveyQue.name = something else. I hope i was able to explain the question well..
VIEWS ON THIS POST

125

Posted on:

Wednesday 7th November 2012
View Replies!

ODBC Drivers error '80040e14'

I keep getting this error on my asp page; i think i need to change the value, but!!! am pretty new to this. I would appreciate if someone would help. Microsoft OLE DB Provider for ODBC Driverserror '80040e14' [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'WHERE'. /PropertyDetailsMail.asp, line 272
VIEWS ON THIS POST

38

Posted on:

Wednesday 7th November 2012
View Replies!

hourly query with export to hourly different filename.csv

Can anyone tell me how to get a different filename every hour after doing the same query. The query has to output a file like this, name.date.time.csv. The date and/or time differ every query. I hope there is someone who can help me.
VIEWS ON THIS POST

120

Posted on:

Saturday 10th November 2012
View Replies!

Dynamic Database Name

Hi , I have a question, how can I put an SQL statement with a dynamic database name I really don't know, is it like Declare $dbname varchar(30) select * from $dbname.dbo.Customer => $dbname is the variable but this is wrong, does anyone know the good sql statement
VIEWS ON THIS POST

42

Posted on:

Saturday 10th November 2012
View Replies!

Query Data Option - DTS

Im connecting 2 sql servers one has source data the other is for publishing the data. When i use the query option on DTS i can put in a sql string, says its okay and also will complete successfully but i can't see any data being added to my table. Why is this happening
VIEWS ON THIS POST

45

Posted on:

Saturday 10th November 2012
View Replies!

Dumbest question ever, where is my SQL database?

I've installed the latest SQL server, ODBC, etc, and installed a program called Bullzip, which converts Access DB's to MySql. The program works great, but where is the database it generates I can't find it anywhere. I looked in the MySQL folder, nothing. I have another program called Dreamcoder for opening the databases and editing fields, it lists the database and all the fields, but I have no idea where it's getting it from. I need to upload the MySQL database to my server so that I can begin converting my Access based ASP code. Where do I find it, and where would I upload it to on a godaddy server
VIEWS ON THIS POST

155

Posted on:

Sunday 11th November 2012
View Replies!

Date format

what is the sql statement for current date for e,g i have PaymentDate DATE DEFAULT 'SYSDATE' is it the right way of writing this statement
VIEWS ON THIS POST

23

Posted on:

Sunday 11th November 2012
View Replies!

Reducing Database File Size

, I have an SQL Server 2000 db which has grown over my storage permit, and buying more is too expensive... I have used the shrinking option in the manager but it only took care of about 10mb (out of 100)... Is there any way to shrink the db further, or am I just going to have to buy more storage space Many
VIEWS ON THIS POST

51

Posted on:

Monday 12th November 2012
View Replies!

SQL update statement needed

hey all. can anyone provide an SQL example for an update statement that is, i am attempting to write an [event procedure] in MS Access that updates [Assisgnment Count] to a table (tbl_Employee_LifeCycle), along with the other data from a report. Overall i needed to obtian a running Sum for a group in my query results. The only way i found to do this was in a report. therefore, I now all of the deed data (from the query) and the Assignment Count associated by Employee (from the running sum function) in a MS Access report. I would like to now update all of this info to a table. there are two fields in the report, the Assignment Count field, called lbl_RecordCount in the report and Employee Name (lbl_Employee).
VIEWS ON THIS POST

80

Posted on:

Tuesday 20th November 2012
View Replies!

ASP and Access DB

, Im really at a dead end!! Im using a .ASP file format, with other .html pages, in order to create a Program that gets some data, put them in a data base, and than calculates some things, creates a new table and then shows us the answers. Well, my problem is exactly at the calculations. I have a table at my DB with N Columns, with numbers as names, and just 1 line with numbers. I have no problem populating it, and all fields are configured as numbers. What I need to do is to look for the column with the smallest number, and retrieve its name. Then, I need to subtract 1 from some columns. Im using the SQL commands in a .asp file, and when I retrieve some information from the table, it doesn't recognize it as a number, and than I cant do any comparisons or calculations at my .asp Here is my code for the query as in my .asp file: do while column!=maxnumbcolumn i=100 column=1 set smallest = connection.execute("select "&column&" from Table as NUMBER") if NUMBER
VIEWS ON THIS POST

15

Posted on:

Tuesday 20th November 2012
View Replies!

Stored Procedure Security Question

In MS's help article on stored procedures it states: They can be used as a security mechanism. Users can be granted permission to execute a stored procedure even if they do not have permission to execute the procedure's statements directly. But I can't find any information as to how this works. I'm trying to run "set identity insert on" within a stored procedure, but get this error when I run it from an account with only datareader/datawriter priveleges: "The current user is not the database or object owner of table 'tablename'. Cannot perform SET operation." Of course when I run this sp with my own account, it runs just fine.
VIEWS ON THIS POST

48

Posted on:

Tuesday 20th November 2012
View Replies!