جلسه sql 4/8/90

--create database db_foroshgah

--go

use

db_foroshgah

go

/*

create table tbl_users

(

users_user nvarchar(50) not null,

users_pass int not null,

users_code int not null primary key,

);

create table tbl_codekala

(

codekala_code int not null primary key,

codekala_name nvarchar(50) not null,

);

create table tbl_anabr

(

anbar_data int not null,

anbar_code int not null ,

anbar_tedad int not null,

anbar_ghkharid int not null,

anbar_ghforosh int not null,

forgian key (codekala_code) refrence tbl_codekala(codekala_code),

);

create table tbl_chdaryafti

(

chdaryafti_data int not null,

chdaryafti_mablagh int not null,

chdaryafti_darvajh nvarchar(50) not null,

chdaryafti_vazeyat nvarchar(50) not null,

);

create table tbl_chpardakhti

(

chdaryafti_data int not null,

chdaryafti_mablagh int not null,

chdaryafti_darvajh nvarchar(50) not null,

chdaryafti_vazeyat nvarchar(50) not null,

);

select * from tbl_users

go

select * from tbl_codekala

go

select * from tbl_anabr

go

select * from tbl_chdaryafti

go

select * from tbl_chpardakhti

go

*/

declare @a1 nvarchar(20)

declare @a2 int

--insert into tbl_users values ('ali',123,1)

--insert into tbl_codekala values (1,'mouse')

--insert into tbl_anabr values (11/8/90,1,20,5000,6500)

set @a2=(select codekala_code from tbl_codekala)

if @a2=1begin

print 'ok'

end

else

begin

print 'no'

end

use db_foroshgah

go

create view view_tbl_anbar

as

select * from tbl_anabr

go

use db_foroshgah

go

select anbar_data as tarikh,anbar_code as code from view_tbl_anbar

use db_foroshgah

go

create procedure pr_insert_anbar

(

@data as int,

@code as int,

@tedad as int,

@ghkharid as int,

@ghforosh as int

)

as

insert into tbl_anabr values(@data,@code,@tedad,@ghkharid,@ghforosh)

go

*/

/*

execute pr_insert_anbar 4,1,4,8000,9500
نظرات 0 + ارسال نظر
برای نمایش آواتار خود در این وبلاگ در سایت Gravatar.com ثبت نام کنید. (راهنما)
ایمیل شما بعد از ثبت نمایش داده نخواهد شد