General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Ms-Sql2000....field check
At the Foxpro, it can controll with INDBC command which field be or not at a file.
Like : (FoxPro)
IF INDBC(_seek,"FIELD") = .F.
ALTER TABLE mal ADD COLUMN ("d" + ALLTRIM(STR(mary))) i NULL
ENDIF
At the Ms-Sql2000 Stored procedure I did a sample as follow. And I had trouble :
1- the row of "ALTER TABLE mal ADD @depo money null" it gives back syntax error for @depo
2- How can I get(handle) a field be or not at a file.
Note : I want to do this operations inside of the stored procedure.
Thanks
Sample code of SQL :
USE foxsql
DECLARE @depo nvarchar(9)
DECLARE depo_hrk CURSOR FOR
SELECT DISTINCT 'depo_' + cast(depo as nvarchar(4)) as depo FROM hrk ORDER BY depo
OPEN depo_hrk
FETCH NEXT FROM depo_hrk INTO @depo
WHILE @@fetch_status = 0
BEGIN
ALTER TABLE mal ADD @depo money null
FETCH NEXT FROM depo_hrk INTO @depo
END
CLOSE depo_hrk
deallocate depo_hrk
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only