Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Mpilo
Yak Posting Veteran
52 Posts |
Posted - 2008-09-10 : 11:25:20
|
| I had two tables my first table is for User-where i add user ,create password and username and more information.then my second table is to store some information that come from first like password & usernamethen i create my stored procedures for this and it work .then now i want to check if the username and Password exist in the user table.if exist then i want to tell the user that He or she must create a new one |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2008-09-10 : 13:26:07
|
There are so many ways to implement this. It all depends on what you are using for your frontend.Not enough info given |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2008-09-10 : 14:35:11
|
| One method (assuming you have sql 2005 or later)Make sure your table as the appropriate constraint to avoid duplicates then:Use a TRY/CATCH block to do the insert. In the CATCH block raise the error that the combination already exists.Be One with the OptimizerTG |
 |
|
|
genius_palli
Starting Member
42 Posts |
Posted - 2008-12-12 : 01:31:52
|
| good morning everyone....I am having a stored procedure. And I have created a new table ( [Table1] say ) with only one field. Now what i want is : To Insert data into the [Table1] by executing the stored procedure.i know that insert into [table name] values select * from [table name1]is possible..but is the following possible------- insert into [table name] values exec storedprocedure --------please help... thanks in advance for ur suggestions.. ----------------------------------Every experience has something to learn. Go get it.Thanks and Regardsgenius_palliWeb Developer |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-12 : 02:02:39
|
it should beinsert into [table name] exec storedprocedure also make sure structure of table is same as resultset of procedure |
 |
|
|
genius_palli
Starting Member
42 Posts |
Posted - 2008-12-12 : 02:19:54
|
| it worked ... great ...thanks for your reply visakh16.Wish you a nice week end :-)----------------------------------Every experience has something to learn. Go get it.Thanks and Regardsgenius_palliWeb Developer |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-12 : 02:54:33
|
| Welcomeyou too have great weekend |
 |
|
|
genius_palli
Starting Member
42 Posts |
Posted - 2008-12-12 : 06:28:34
|
| hi everyone..I am trying to :-create a temporary table and then insert data into the temporary table by executing the stored procedure. Next i am trying to use the temporary table in the Common table expressions. Is this possible.sample piece of code..create table #temp([column name] int)insert into #temp exec [stored procedure name]with cte as(some piece of code without using #temp),Select <some piece of code using #temp and cte>please help... great thanks in advance.----------------------------------Every experience has something to learn. Go get it.Thanks and Regardsgenius_palliWeb Developer |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-12 : 08:54:39
|
| its possible. but since cte is coming after temp table you need to put a ; on left side of with |
 |
|
|
|
|
|