The error is due to, you are trying to use the UNASSIGNED variable. custID string array is assigned value inside the WHILE block, this is not sure for the compiler that the code where you are assigning the value to the variable will execute. But the line 15 will surely executed and will generate Error cos the custID might be null.
To avoid this condition you can use default values to be assigned to the variables at the time of declaration....
User Profile
Collapse
-
IF you are creating WEB application then in web.config <Connection> you can increase the time out property value.
Or better is that : I think you have a lots of data in your table,So you should increase the filter criteria from UI,so you will search less data,which required less time.
One more thing the Query/Procedure you have create to Search need to more OPTIMIZED use less JOINS.
And create indexes...Leave a comment:
-
YOu are using left outer join ,so you need to put your first (table from which you want to take data) on left side of join.
SELECT m.meter_addr, r.Date, r.Reading
FROM WebSite_Support .dbo.Readings AS r
LEFT OUTER JOIN
meter_table AS m
ON m.meter_addr = r.meter_ID
Hope this will help you.
-Pankaj TambeLeave a comment:
-
For aliases in WHERE clause you can use two level select query.
SELECT * FROM (
SELECT DISTINCT REPLACE(HOME_PH ONE,'-','') a
FROM X )
WHERE HOME_PHONE IS NOT NULL AND DO_NOT_CALL IN ('Y','X','1')
AND a NOT IN
(SELECT DISTINCT PHONENUMBER FROM X WHERE PHONENUMBER IS NOT NULL)
Hope this will help you .
-Pankaj Tambe.Leave a comment:
-
That means you want to use dynamic sql
DECLARE @Sql nvarchar(100)
SET @Sql ='Select * from '+ @localDBName + '..Customers'
EXEC @Sql
Hope this will work for the part of you SP
-HAPPY QUERY
-Pankaj TambeLeave a comment:
-
First you have to check NULL values for primary key.
And now my suggestion is that you need to create two DIFFRERENT TRANSACTIONS to insert/update in parent and child tabels.
Not sure but when you create a transaction and insert/update any rows in parent tables, these are not inserted until you have not COMMIT the transaction.
Because of that when you try to insert rows in child table it does'nt found the parent...Leave a comment:
-
Insted of "select @@identity as productid[/CODE]"
You can use select SCOPE_IDENTITY( )
_Pankaj TambeLeave a comment:
-
Its simple..as suggested by ck9663 you need to explore worl of joins.
You can say foreign keys are used to maintaine the relationships of tables.
You can use this
SELECT POSTS.*,TOPICS. *,SUBFORUM.*,US ERS.* from
POSTS INNER JOIN TOPICS ON POSTS.TOPIC_ID= TOPICS.ID
INNER JOIN USERS ON POSTS.USER_ID=U SERS.ID
INNER JOIN SUBFORUM ON TOPICS.SUBFORUM _ID=SUBFORUM.ID
Insted of stars...Leave a comment:
-
SELECT * FROM
Table1 INNER JOIN Table2 ON Table1.SID=Tabl e2.SID
OR
SELECT table1.*,Table2 .* FROM
Table1 INNER JOIN Table2 ON Table1.SID=Tabl e2.SID
HAPPY QUERY...
- Pankaj TambeLeave a comment:
-
Remote Sql server Connection
Connection string is not valid: might this is because of user name or password is wrong.
To create authenticated user you need to create a LOGIN in remote server and provide permmissions for particular DATABASES.
Then follow the points on remote sql server :
1.START-> All Programs ->Sql server 2005 -> Configuration tools->
Sql Server...Leave a comment:
No activity results to display
Show More
Leave a comment: