SQL Questions


Execute command in SQL
can someone tell me the error in this statement declare @cmd nvarchar(4000) declare @PatNo bigint set @PatNo=123 set @cmd= N’insert into TmpDues ( PatNo, BillDate, ReceiptNo, PayMode Amt) select ReceiptTable.PatNo,ReceiptTable.BillDate,ReceiptTable.ReceiptNO,’+ ”’Cash”’+’ as PayMode,CashAmount From ‘ + @databasename + ‘.dbo.ReceiptTable where PAtNo=’ + cast(@PAtNo as nvarchar) exec @Cmd

Answer Question   |  May 16, 2009  6:26 AM
SQL, SQL error messages, SQL queries
asked by:
5 pts.

Call SQR (Structured Query Reporter)
how to call sqr on aix and return spf to windows

Answer Question   |  May 11, 2009  12:54 AM
AIX, SQL, SQR, Structured Query Reporter
asked by:
5 pts.

SQL Server 2005
CAN ANYBODY HELP ME “HOW TO ASSIGN A SQL-STATEMENT IN A VARIABLE”. FOR EXAMPLE : TO ASSIGN A STRING IN A VARIABLE, WE DO LIKE THIS: DECLARE @A AS VARCHAR(20) SET @A=’HAI’ PRINT @A OUTPUT: HAI SIMILARLY HOW TO ASSIGN A SQL-STATEMENT IN A VARIABLE.

Answer Question   |  May 11, 2009  6:37 AM
SQL, SQL Server 2005, SQL statements, SQL variables
asked by:
30 pts.

SQL or RPG
Would it be better to use SQL or RPG, to update one field in the file with a value from another field in the same file? I am not that familiar with SQL, only a beginner. My RPG skills are rusty as I’ve not written anything in the last 4 years.

Answer Question   |  May 8, 2009  3:22 PM
RPG, SQL
asked by:
20 pts.

Read/Write ability to MSSQL using FoxPro 2.6 for DOS
Hi All My company has a DOS Based Accounting system running under FPD 2.6 for DOS. We have purchased a project planning package that sits on a SQL server. I need to be able to transfer actuals from our DOS (dbase4) accounting data to MSSQL and also read from MSSQL for reporting purposes. Is this [...]

Answer Question   |  May 4, 2009  8:14 PM
FoxPro 2.6, FoxPro 2.6 for DOS, SQL
asked by:
5 pts.

SQL Log files
Can I delete a SQL log file

Answer Question   |  May 16, 2009  2:43 PM
SQL, SQL Log Files
asked by:
5 pts.

Upload a table to Mainframe
How can I upload a SQL table to mainframe dataset? I want to know the proper syntax of how can i upload a table to Mainframe using FTP

Answer Question   |  September 29, 2009  11:53 AM
Mainframe, Mainframe Datasets, SQL, z/OS, z/OS configuration
asked by:
20 pts.

Different Results on Insert Select than Select
I’m struggling, along with others, where I’m getting different results when doing an Insert select verses just the select. Lots of joins to get data from various tables. Only want the first record from the uniqfield table so created the tmp_uniqfieldid table with that item fielded, creation_ts thinking it would help matters….. Here is the [...]

Answer Question   |  May 4, 2009  11:36 PM
INSERT SELECT statement, SELECT statement, SQL, SQL query optimization, SQL statements
asked by:
Bem
35 pts.

SQL order by Issue
Please help me write this. I need a SQL where the order by is done based on a variable passed to the query.SELECT * FROM (SELECT distinct gl.group_id, gl.group_name, gl.group_description, gl.status_code, gl.member_count, (SELECT grpp.group_name FROM test_group_relationship grel JOIN test_group grpp ON grel.parent_group_id = grpp.group_id WHERE grel.child_group_id = gl.group_id ) AS parent_group_name, gl.group_name_key, gl.group_description_key FROM test_group [...]

Answer Question   |  May 4, 2009  4:44 PM
Dynamic SQL, SELECT statement, SQL, SQL query optimization
asked by:
25 pts.

split column
i need to take a column in my database and split it into different columns based on a question id. Basically i want to write a whole bunch of sql statements that are non related for one grid – a whole bunch of sql statements each with their own where statement

Answer Question   |  May 5, 2009  3:26 PM
SQL, SQL tables
asked by:
60 pts.

My DTS package runs normally, but hangs when run as a SQL Job
Hi, I’m trying to run an Ms Access .mbd file through a MS SQL 2003 Server. The package runs normally and works when I start the job, but simply hangs when I run the package as a a scheduled job. I’ve designed a DTS local package as follows: ‘********************************************************************** ‘ Visual Basic ActiveX Script ‘************************************************************************ [...]

Answer Question   |  April 29, 2009  6:01 PM
ActiveX, DTS Local Package, DTS package, Job scheduling, Microsoft Access, SQL, SQL Jobs, SQL Server 2003
asked by:
5 pts.

I want to read a pf and build a corresponding SQL statement and save the statemnet in text file.
how can i read pf ?as pf is colomn speciffic have to read pf like it will have feilds and some constraint, key, record. how can i build a corresponding SQL statement ? i m new in AS/400 but i have to submit this utility to my manager this thursday.. can anybody help me in [...]

Answer Question   |  April 29, 2009  11:10 AM
RPGLE, SQL, SQL statements
asked by:
0 pts.

Easytrieve – Dynamically assigning collection id
How do I dynamically assign a collection id to an Easytrieve program? I have an Easytrieve program which is an input parm within a mainframe Proc. My SQL works fine when the collection ID is assigned on the “PARM SSID(xxxx)” statement. How can I get this value to be assigned at run type without coding [...]

Answer Question   |  April 24, 2009  2:08 PM
Easytrieve, SQL
asked by:
35 pts.

SQL in RPG (Error when TESTING (i.e. running under ISDB) RPG program which builds SQL statement and then uses PREPARE,DECLARE,OPEN,FETCH,CLOSE)
Under ISDB, JOBLOG showed’ Internal Error 1001 has occurred SQLCOD -901′ SQLCOD was ‘-901’ (i.e. minus 901) which according to manual ’SQL Programming’ is associated with Message SQL0901 – ‘SQL System Error’ SQLERP was ‘QSQROUTE’ – According to Manual ‘DB2 Universal Database for ISeries Appendix B SQL Comms Area’, SQLERP contains the name of the [...]

Answer Question   |  April 24, 2009  11:29 AM
RPG, SQL, SQL in RPG, SQL Testing
asked by:
15 pts.

SQL login client not admin
it is payday and on the client side of our DB there are some login errors, where in SQL do you go to check points of failure?

Answer Question   |  April 24, 2009  5:39 PM
SQL, SQL performance, SQL Troubleshooting
asked by:
40 pts.

Output errors from SQL Server stored procedure
I have a stored procedure using SQL Express that update a table using data from another table. All is well except that from time to time the source table might have data that causes an error. I would like to add some code to the stored procedure that will catch the error, output the details [...]

Answer Question   |  April 26, 2009  1:28 AM
SQL, SQL error handling, SQL Server Express, SQL Server stored procedures, Stored Procedures
asked by:
35 pts.

SQL/400 field editing
What is the best (easiest!!) way to add editing to fields in an SQL-created table?

Answer Question   |  December 15, 2009  9:27 PM
AS/400 SQL, SQL, SQL/400
asked by:
2,555 pts.

Unique ID for existing table
I want to add a column to an existing table where its values should be unique and auto generated in a sequential order

Answer Question   |  April 21, 2009  11:15 AM
Auto increment, Database design, Database programming, SQL
asked by:
60 pts.

Local Security for Vista Home Premium – Network Access
Hi there Vista Home Premium – I’ve been trying to configure the local security option for Network Access – sharing and security model for local accounts, to ‘Classic – local users authenticate as themselves’. This PC communicates with another where an account has been created ( user and password (windows authenticate)) and is needed to [...]

Answer Question   |  April 20, 2009  4:51 AM
Authentication, C#, Classic - Local users authenticate as themselves, Desktop security, Local security, Network access, SQL, User authentication, Vista Home premium, Windows Vista
asked by:
5 pts.

How to config iSQL Plus on computer without a domain
Hello I have Oracle 9i installed in my home computer and i want to work in iSql Plus, but i am not able to do it. I tried running the apache server but then when i tried to login i get a error message “The server encountered an internal error or misconfiguration and was unable [...]

Answer Question   |  April 20, 2009  3:32 AM
isql, iSQL*Plus, Oracle, Oracle 9i, SQL, SQL Plus
asked by:
5 pts.