Click here to Skip to main content
15,921,990 members
Home / Discussions / Database
   

Database

 
GeneralRe: Finding Database name Pin
alok_2k324-Feb-08 20:23
alok_2k324-Feb-08 20:23 
GeneralRe: Finding Database name Pin
Giorgi Dalakishvili24-Feb-08 20:25
mentorGiorgi Dalakishvili24-Feb-08 20:25 
GeneralQuery result not as expected [modified] Pin
Andy_L_J23-Feb-08 17:35
Andy_L_J23-Feb-08 17:35 
GeneralRe: Query result not as expected Pin
GuyThiebaut24-Feb-08 11:18
professionalGuyThiebaut24-Feb-08 11:18 
GeneralRe: Query result not as expected Pin
Andy_L_J24-Feb-08 13:28
Andy_L_J24-Feb-08 13:28 
GeneralHelp with this select Pin
Caio Vitor23-Feb-08 5:25
Caio Vitor23-Feb-08 5:25 
GeneralRe: Help with this select Pin
Caio Vitor23-Feb-08 6:34
Caio Vitor23-Feb-08 6:34 
Generalsp_executesql Pin
SVb.net22-Feb-08 22:09
SVb.net22-Feb-08 22:09 
i need to declare variables dynamic , then this my code for make that .but i can't used
why????????????????????
Declare @TableName Char(100)
Set @TableName = 'Ar_PromotionDetails' --{Columns}PromotionId
Declare Cur_Sys_DataAdapterTable Cursor
For
Select Cln.name As [Columns] , Type.Name Types , Cln.Length ,
Cln.xprec , Cln.xscale
From sysobjects Obj
inner join syscolumns Cln
On Obj.Id = Cln.id
Inner join systypes Type
On Type.xtype = Cln.xtype
Where obj.id = object_Id(@TableName)
Declare @ColumnName char(120) , @TypeName char(120)
Declare @Length SmallInt
Declare @xprec Tinyint , @xscale Tinyint
Open Cur_Sys_DataAdapterTable
Fetch Next From Cur_Sys_DataAdapterTable
Into @ColumnName , @TypeName , @Length ,@xprec , @xscale
Declare @DeclareVariable NChar(300)
Set @DeclareVariable =N''
While @@fetch_status = 0
begin
if ( LOWER(Rtrim(@TypeName)) in ( 'datetime' , 'bit' , 'int' , 'bigint',
'smallint' , 'tinyint' , 'bigint' ,
'smalldatetime' , 'float') )
Set @DeclareVariable = Rtrim(@ColumnName) + space(5) + Rtrim(@TypeName)
else
if ( LOWER (Rtrim(@TypeName)) in ('numeric' , 'decimal' ) )
Set @DeclareVariable = Rtrim(@ColumnName) + space(5)+Rtrim(@TypeName) +
N'('+ Rtrim(@xprec)+ N',' + Rtrim(@xscale) +N')'
else
Set @DeclareVariable = Rtrim(@ColumnName) + space(5)+Rtrim(@TypeName)+N'(' + Rtrim(@Length) + N')'
Set @DeclareVariable = N'Declare @@' + @DeclareVariable + Char(13)
Exec sp_Executesql @DeclareVariable
print 'load ok...'
Fetch Next From Cur_Sys_DataAdapterTable
Into @ColumnName , @TypeName , @Length , @xprec , @xscale
End
Close Cur_Sys_DataAdapterTable
deallocate Cur_Sys_DataAdapterTable
Select @@PromotionId --when i use this command make error (Server: Msg 137, Level 15, State 2, Line 62
Must declare the variable '@@PromotionId'.)
how i can resolve this problem?

123

QuestionACCESS AND SQL HELP(A students question) Pin
ABQ4722-Feb-08 10:46
ABQ4722-Feb-08 10:46 
GeneralRe: ACCESS AND SQL HELP(A students question) Pin
pmarfleet22-Feb-08 10:58
pmarfleet22-Feb-08 10:58 
GeneralRe: ACCESS AND SQL HELP(A students question) Pin
Christian Graus22-Feb-08 11:15
protectorChristian Graus22-Feb-08 11:15 
GeneralRe: ACCESS AND SQL HELP(A students question) Pin
Paul Conrad25-Feb-08 8:51
professionalPaul Conrad25-Feb-08 8:51 
GeneralCombine 2 unrelated tables Pin
Lash2022-Feb-08 7:18
Lash2022-Feb-08 7:18 
GeneralRe: Combine 2 unrelated tables Pin
Lash2022-Feb-08 9:13
Lash2022-Feb-08 9:13 
GeneralRe: Combine 2 unrelated tables Pin
Mark J. Miller22-Feb-08 9:54
Mark J. Miller22-Feb-08 9:54 
GeneralCrystal Report with Ms SQL Server Pin
Member 367504722-Feb-08 0:58
Member 367504722-Feb-08 0:58 
GeneralAddress database schema Pin
pmpdesign21-Feb-08 15:44
pmpdesign21-Feb-08 15:44 
GeneralRe: Address database schema Pin
Christian Graus21-Feb-08 16:31
protectorChristian Graus21-Feb-08 16:31 
GeneralRe: Address database schema Pin
pmpdesign21-Feb-08 17:29
pmpdesign21-Feb-08 17:29 
GeneralRe: Address database schema Pin
Mark Churchill24-Feb-08 13:13
Mark Churchill24-Feb-08 13:13 
GeneralRe: Address database schema Pin
pmpdesign24-Feb-08 14:21
pmpdesign24-Feb-08 14:21 
GeneralRe: Address database schema Pin
GuyThiebaut21-Feb-08 22:29
professionalGuyThiebaut21-Feb-08 22:29 
GeneralIssue with Testing result of SQL SELECT Pin
Brian C Hart21-Feb-08 11:57
professionalBrian C Hart21-Feb-08 11:57 
QuestionRe: Issue with Testing result of SQL SELECT Pin
pmarfleet21-Feb-08 12:38
pmarfleet21-Feb-08 12:38 
GeneralRe: Issue with Testing result of SQL SELECT Pin
Hesham Amin21-Feb-08 22:33
Hesham Amin21-Feb-08 22:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.