Find Records With A Blank Field
Mar 13, 2000
I want to be able to use a query to display all the records in the 6.5 database that have no data in the STATUS field. This is the query I thought would work....."SELECT * from travel_date WHERE status="''"
But, that is not working. Can someone please help me figure out the right way to wrtie this?
I appreciate your help!
View 2 Replies
ADVERTISEMENT
Dec 30, 2003
I need to pass in null/blank value in the date field or declare the field as string and convert date back to string.
I tried the 2nd option but I am having trouble converting the two digits of the recordset (rs_get_msp_info(2), 1, 2))) into a four digit yr. But it will only the yr in two digits.
The mfg_start_date is delcared as a string variable
mfg_start_date = CStr(CDate(Mid(rs_get_msp_info(2), 3, 2) & "/" & Mid(rs_get_msp_info(2), 5, 2) & "/" & Mid(rs_get_msp_info(2), 1, 2)))
option 1
I will have to declare the mfg_start_date as date but I need to send in a blank value for this variable in the stored procedure. It won't accept a null or blank value.
With refresh_shipping_sched
.ActiveConnection = CurrentProject.Connection
.CommandText = "spRefresh_shipping_sched"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter("ret_val", adInteger, adParamReturnValue)
.Parameters.Append .CreateParameter("@option", adInteger, adParamInput, 4, update_option)
.Parameters.Append .CreateParameter("@mfg_ord_num", adChar, adParamInput, mfg_ord_num_length, "")
.Parameters.Append .CreateParameter("@mfg_start_date", adChar, adParamInput, 10, "")
Set rs_refresh_shipping_sched = .Execute
End
Please help
View 6 Replies
View Related
Dec 20, 2006
Is there a script or table that I can check to find out if there are any users who have BLANK passwords?
thanks
View 3 Replies
View Related
Oct 31, 2007
Hi everyone ,
i am trying to find logins which has blank password in SQL2000 . i wrote cursor to find these logins. But i cannot catch the logins.Beacuse sp_password sistem procedure does not return @@ERROR.
I can easily do it with SQL2005 (BEGIN -TRY -CATCH).
How can i catch sp_password error in SQL Server 2000??
or are there any suggestions to find these logins.
How can i find blank password logins in SQL2000???
sp_password '','','loginname'
select @@error ''' it is always ZERO
Declare @sql as varchar(255)
Declare @login as varchar(50)
Declare Cur_Login CURSOR scroll FOR
Select name from syslogins where isntuser=0
open Cur_Login
fetch next from Cur_Login INTO @Login
WHILE @@FETCH_STATUS = 0
begin
set @sql = 'sp_password '''','''',''@login'' '
set @sql = replace(@sql ,'@login',@login)
exec (@sql)
if @@ERROR <> 0
print 'Password is not blank'
fetch next from Cur_Login INTO @Login
end
close Cur_Login
deallocate Cur_Login
View 6 Replies
View Related
Jan 1, 2008
Hi:I have written a SQL statement that accepts a letter and then prints out all the records in a table starting with that letter. I was wondering if there is a way that I could change the query so that if prints out all records if a blank or empty value is passed in?Here's my query: ALTER PROCEDURE [dbo].[GetMediaListByFirstLetter] ( @firstLetter char(1))AS SELECT Media_ID, OrgName FROM Media WHERE UPPER(SUBSTRING(Media.OrgName,1,1)) = @firstLetterAny help doing this would be greatly appreciated.Roger
View 5 Replies
View Related
Jun 23, 2005
We imported approximately 2.9 million records from our mainframe server
into our SQL Server but have run into a problem. The data in a
few of the fields contains both leading and trailing spaces. An
example of the data would be like this, using periods to represent
spaces:
What we have:
..1A02938.....
What we need:
1A02938 (no spaces)
Is there some sort of algorithm I can run on the data to remove
those spaces? The problem is coming up when trying to perform a
SELECT query. We try something like:
SELECT * FROM PCPIPT0 WHERE PANO20 = "1A02938" but we get zero
results because of the spaces in the database. The datatype of
the filed is char(20) because we need some flexibility on the size of
the data stored.
Any assistance would be greatly appreciated.
View 5 Replies
View Related
Mar 20, 2006
Hi there,
I'm in a bit of a jam here and will appreciate any help.
I need the SQL code to replace a record if the record is empty.
For instance, I have about 7 columns containing over 40K records. In the firstname field, some records are blank. I need to replace all the blank firstname fields with this: 'now invalid' (without the quotes)
What would be the best way to achieve this?
Thanks
newbie:o
View 6 Replies
View Related
Oct 7, 2007
hi
I have data in two tables.
NAMES
IDName
1FIRST
2SECOND
CODES
IDCodeTypeCode
1Axyz
1Babc
1Cgfd
2Axdz
2Bdca
I want to join the two tables to add the Code of CodeType "C" to the records of NAMES
Result Example
IDNameCode
1FIRSTgfd
2SECOND----
I want to have all records from the names with the codetype C, if there is no record with the codetype c for a given ID, the cell should be blank to identify for which ID's the CodeType C is mising.
how should the sql statement look like?
Please help!
thanks in advance!
Mikk
View 1 Replies
View Related
Feb 7, 2007
In my report I want an optional parameter to filter all records with a specific field that is not blank. I tried several scenario's without result...
In the parameter I want to set a text value like "exampletext".
In the filter I want a check: if the parameter value is "exampletext", only show the records where field "abc" is not blank.
On the tab Filters from the Table properties I can set three values: Expression, Operator and Value.
Please help!
View 1 Replies
View Related
Jun 30, 2005
I am trying to load a field in my DB and it is defined as varchar(11) but when I populate it, it still adds spaces at the end. When I try to use it in an If statement, it doesn't match and executes the else instead. The wierd part is it seems to make it 10 characters long and not 11 or the the actual length. I think I had originally set it up for char(10) then changed it afterward but I even deleted the field and reentered it as varchar(11).Thanks,Eric
View 3 Replies
View Related
Apr 2, 2008
Originally, I hit this problem with PHP. But then I was able to reproduce using VBScript.
I have a table with a couple of text fields, and one Real field in a table. One row of data in the table. Both text fields set, but the real field doesn't even need to have a value set.
Connecting to SQL 2005 using a DSN - ODBC.
I'm using a stored procedure I named ExecIt that runs a SQL statement that is sent in and returns records.
If I use cursor location adUseClient, it returns values for the text fields.
If I use asUseServer, it returns blank values.
If I use a SQL statement directly, it works. Only fails when using SQL statement by way of ExecIt.
In each case, cursor type is adOpenStatic or adOpenDynamic.
Using this combination fo cursor type and cursor location, it mimics what I see in SQL profiler when PHP is using ODBC.
Anyone have a solution?
Table:
CREATE TABLE [dbo].[test3](
[ID] [int] IDENTITY(1,1) NOT NULL,
[text1] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[text2] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[real1] [real] NULL,
CONSTRAINT [PK_ReworkLog2] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
Stored Procedure - ExecIt:
create PROCEDURE [dbo].[ExecIt]
-- Add the parameters for the stored procedure here
@Statement nvarchar(max)
AS
BEGIN
exec (@Statement)
END
DSN has been set up through ODBC manager. Can be using 2005 native driver, or older sql server driver.
Code:
dim txtOut
set conn1=CreateObject("ADODB.Connection")
conn1.Open "my-DSN","my-userid","my-password"
sql="exec execit 'select * from test3 where ID=1'"
set rs = CreateObject("ADODB.recordset")
rs.CursorLocation = 2 'adUseServer - 2, adUseClient - 3
rs.CursorType = 3 'adOpenStatic
rs.Open sql,conn1
if not rs.EOF then
txtOut = "Results" & vbcrlf
txtOut = txtOut &"text1:" & rs("text1") & vbcrlf
txtOut = txtOut &"text2:" & rs("text2") & vbcrlf
txtOut = txtOut & vbcrlf
end if
msgbox txtOut
rs.Close
conn1.Close
View 3 Replies
View Related
Aug 20, 2007
Hi i hv a doubt in Sql server reporting..I do generate some reports based on some criteria.In the results screen i hv empty fields based on the search i hv generated.I need to set "0" instead of blank spaces in the fields..Can any one help me?
View 5 Replies
View Related
Mar 10, 2015
I am creating a report on an asp.net webpage to show how many times a coupon has been used from a set list of items.There are two tables I am using for this query.Table 1 has the list of items or coupons. Table 2 has a column for the item id from Table 1 and a value.
Example:
Table 1
id Name
1 Coupon1
2 Coupon2
3 Coupon3
[code]...
My current query will only show coupon1 and coupon2 and the number and value. It will not show coupon2 since it hasn't been used. I would still like to show coupon2 with a number of zero and a value of zero.
Current query is:
SELECT Table1.Name, COUNT(Table2.ID) AS CNum, SUM(Table2.Value) AS CValue FROM Table2 JOIN Table1 ON Table2.ID = Table1.ID GROUP BY Table1.Name
View 5 Replies
View Related
Nov 29, 2000
Data from as400 imports into SQL with blank fields which is the way as400 outputs records. How can you insert previous record of data null or blank field. ex:
ONETWO
a1
2
3
b1
2
3
Would want:
ONETWO
a1
a2
a3
b1
b2
b3
View 5 Replies
View Related
Oct 27, 2004
i have a trigger on a table right now... when fields are inserted, theres a text field inserted and i want to check if that text field = '' (the empty string, not NULL) and if it doesn't equal that, then perform some row updates on other tables, but if it is empty, to not do anything else in the trigger... right now i have this:
Code:
IF ((SELECT Note FROM XATPoDetail WHERE ReqNbr = (SELECT ReqNbr FROM Inserted)) LIKE(''))
Note is the text field, XATPoDetail is the table where its being inserted into. I had to do the select FROM the table because it wouldn't let me select a text data type from the "Inserted" virtual table
but it tells me me "Error 279: The text, ntext, and image data types are invalid in this subquery or aggregate expression"
thanks
View 2 Replies
View Related
Oct 27, 2004
i have a trigger on a table right now... when fields are inserted, theres a text field inserted and i want to check if that text field = '' (the empty string, not NULL) and if it doesn't equal that, then perform some row updates on other tables, but if it is empty, to not do anything else in the trigger... right now i have this:
IF ((SELECT Note FROM XATPoDetail WHERE ReqNbr = (SELECT ReqNbr FROM Inserted)) LIKE(''))
Note is the text field, XATPoDetail is the table where its being inserted into. I had to do the select FROM the table because it wouldn't let me select a text data type from the "Inserted" virtual table
but it tells me me "Error 279: The text, ntext, and image data types are invalid in this subquery or aggregate expression"
thanks
View 3 Replies
View Related
Aug 18, 2015
I wanted to remove duplicate records from SSRS report. I set the "Hide Duplicates" to True. It is now working, But i am getting the space between the two records, which i want to get rid of. How to get rid of extra spaces between two records ( Please find the details below).
View 5 Replies
View Related
Oct 31, 2007
Hi, I have had this problem for a while and have not been able solve it.
What im looking at doing is looping thru my patient table and trying to organise the patients in to there admission sequence, so when patient "A" comes in and is treated at my hospital and is discharged and admitted to another Hospital within one day then patient "A" will get a code of 1 being there first admission.
then if patient "A" is admitted again but there admission date is greater than one day they get a code of 2 being for there second admission but will need to loop thru table looking for other admissions and discharges.
The table name is Adm_disc_Match_tbl
Basically what i have 4 fields.
Index_key = which is the patient common link (text)
ur_episode = this wil change for each Hospital (text)
Admission_datetime = patient admission date and time (datetime)
Discharge_datetime = patient discharge date and time (datetime)
example of data
Code: ( text )
Index_key,ur_episode,Admission_datetime,discharge_ datetime
HERBERT-7/1929,513884-1686900,4/07/2006 10:58,17/07/2006 13:37
HERBERT-7/1929,C023092-1698859,17/07/2006 13:20,24/07/2006 0:30
ELSIE-5/1916,G148445-1720874,8/08/2006 11:00,30/08/2006 10:00
STANISLAWA-3/1918 ,G119981-1720045,8/08/2006 13:01,22/08/2006 12:13
FREDA-11/1925,183772-1998910,27/03/2007 9:53,3/04/2007 11:06
FREDA-11/1925,G147858-2007408,3/04/2007 10:49,26/04/2007 12:39
FREDA-11/1925,183772-2037727,28/04/2007 17:05,9/05/2007 11:41
FREDA-11/1925,G147858-2052082,9/05/2007 12:00,25/05/2007 11:17
If anyone could help it would be much appreciated.
View 6 Replies
View Related
Apr 29, 2008
Hi,
I receive blanks for a column called value and i need to represent it as a blank or NA into a colum whose datatype is float in the datawarehouse.
how is this possible because in current schenario a blank is being converted to 0
which is not the right thing.
i would like to retain the blank in conversion from char to float ,
please explain me if it can be done or how to overcome this issue.
Thanks
View 1 Replies
View Related
Aug 5, 2015
I'm looking for a way of taking a query which returns a set of date time fields (probable maximum of 20 rows) and looping through each value to see if it exists in a separate table.
E.g.
Query 1
Select ID, Person, ProposedEvent, DayField, TimeField
from MyOptions
where person = 'me'
Table
Select Person, ExistingEvent, DayField, TimeField
from MyTimetable
where person ='me'
Loop through Query 1 and if it finds ANY matching Dayfield AND Timefield in Query/Table 2, return the ProposedEvent (just as a message, the loop could stop there), if no match a message saying all is fine can proceed to process form blah blah.
I'm essentially wanting somebody to select a bunch of events in a form, query 1 then finds all the days and times those events happen and check that none of them exist in the MyTimetable table.
View 5 Replies
View Related
Sep 7, 2001
Hi all,
Anybody would tell me how can I find last 10 records in a table using T-SQL?
Thank you very much!
Lee
View 3 Replies
View Related
Aug 1, 2007
Hello,
Having trouble describing my problem……
I have the table below, and I am trying to retrieve TileIDs that have the same ModelIDs.
ModelID TileID
HP DL380 G3 120v Dual15400
HP DL380 G3 120v Dual15400
HP DL380 G3 120v Dual15400
HP DL380 G3 120v Dual15400
HP DL380 G3 120v Dual15400
HP DL380 G3 120v Dual15400
Sun SF 280R 120v 15401
Sun SF 280R 120v 15401
Sun SF 280R 120v 15401
Sun SF 280R 120v 15401
Lantronix MSS4 15401
So TileID ‘15400’ would be a keeper, since all ModelIDs are the same.
Any help would be appreciated.
Thanks
View 4 Replies
View Related
Jun 24, 2008
Hello friends,
plza help meeeeeeee
View 3 Replies
View Related
Mar 4, 2008
tbl_user Data
user Updatedate
Bill 08/02/2006
Bill 08/02/2008
Peter 11/02/2008
Liz 01/02/2008
sam 01/02/2007
select * from
where Updatedate < getdate()-30 days and (not in Updatedate > getdate())
i want to get all records
output i am looking....
user Updatedate
Liz 01/02/2008
sam 01/02/2007
View 4 Replies
View Related
Jun 9, 2008
Hi all,
How to find a particular field from a table? I have so many tables in my DB and I don't know the table name which has the field.
View 1 Replies
View Related
Dec 3, 2007
Hi All, I am trying to find records when searchProductCount = 2 AND when searchProductCount < 2 BUT productID not in (select pid from TableB) ... I have the query below ... but is there any other better way to do this?
TableB has IDs: 100, 700 ...etc
eg: searchProduct ID is 50,100
-- means returns everything when we found ALL productID (50,100) from TableA, count =2
Select productName, productID from TableA where searchProductCount = 2 AND productID IN (50,100)
union all
-- when not all productID found in TableA, we only return productsID from TableA which ID found in TableB, count < 2
Select productName, productID from TableA where searchProductCount < 2 and productID IN (select pid from TableB) -- in this case, pid found in TableB from searchProductID will be 100
------------------------------------------------------------------
it comes out there are duplicates results (when first query is valid, we union all second query, so we have duplicates records). How can we eliminate the duplicates? Or is there better way to acheive this without using union all?
View 3 Replies
View Related
Jan 12, 2000
Hi,
Does anybody know the SQL query to find the duplicate records?
Many Thanks in advance!
View 2 Replies
View Related
Feb 4, 2003
Hello board,
I was wondering if anyone can tell me an easy way to find duplicate records on sql. The thing is this, at work we have a database (table) which includes tracking numbers, I need a easy way to be able to search this table for duplicate tracking numbers and print them out. I currently access this table to edit some data by using the following path “Start > Programs > Microsoft SQL Server > Enterprise Manager” then work my down the tree to “Databases > Master > Tables” on tables I do a right click and “open table/query”. Any help would be most appreciated. Believe me I’m very “SQL illiterate”
Bill
:confused:
View 2 Replies
View Related
May 13, 1999
Hi,
As far as I know in SQL Server 6.5 there is no concept called rowid. How can I find duplicate records in a table and delete them.
Thanks,
Srini
View 2 Replies
View Related
Apr 17, 2014
I have this query that I have been using to find duplicate records works great except for now. The logic I am adding is pcs_rreas <> 'NG'. When I add this it does take out the NG, but it also excludes the reocords that have NULL data in this field. I don't want that to happen. How can I fix this? I tried adding (pcs_rreas <> 'NG' or pcs_rreas is null) but nothing is pulling now.
SELECT pcs_id1, pcs_rreas, pcs_lname, pcs_fname, pcs_minit, pcs_degree, pcs_xtyp, pcs_office, pcs_dba, pcs_dob, pcs_sex, pcs_eff, pcs_trm, pcs_spec1, pcs_spec2, pcs_spec3,
pcs_spec4, pcs_tax1, pcs_ssn, pcs_altid, pcs_upin, pcs_medic, pcs_mcaid, pcs_ecs, pcs_npi, pcs_status, pcs_dir, pcs_den, pcs_www, pcs_hold, pcs_email,
pcs_misc1, pcs_misc2, pcs_newdt, pcs_newby, pcs_chgdt, pcs_chgby, pcs_malp, pcs_pf, pcs_ctl, pcs_sys, pcs_pay, pcs_ann, pcs_bcert, pcs_pass, pcs_w9,
pcs_taxex, pcs_tax2, pcs_type, pcs_rreas, pcs_routo, pcs_rtime, pcs_rdate, pcs_force, pcs_flag, pcs_v419, pcs_bcity, pcs_bstate,
[code]...
View 3 Replies
View Related
Dec 16, 2007
Hi all,
I have a question regarding SQL Server Performance and would be grateful for a tip. Let's say I have a DB with 50.000 records. These records belong to 1.000 different datasets, so there is 1 actual and 49 historical data records. For example a company with 1000 employees has a database where each year a new record is created for each employee so after 50 years they have 50.000 records (50 years x 1000 employees). 1 record is actual, and 49 are historical. What is the best way to store this? Main target is performance for the enduser, so when an employee clicks "See all my records" it should be fast. But on the other hand the application mainly works only with the current year. Additionally it should also be fast for the boss of business unit who wants to see the latest records of his e.g. 100 employees. I have some ideas and would like to get your opinion:
1. Retrieve by latest date
Just store the records. To get the current year just select the record with the latest year. Disadvantage might be with larger databases: If the company switches to store the requests per month, each user would have 600 records (12 months x 50 years). Each time the latest record should be retrieved, 600 recards have to be compared regarding the latest date (or sorted by date descending using Top1, but this might be a problem for the boss then? Or could this be combined for a group if the boss wants to see all the latest records of his employees?).
2. Add a 'IsCurrent'-Flag
Each time a new record is stored it should be compared to the latest record. If it is newer, the 'IsCurrent'-Flag should be removed and then checked on the new record. This should be fast processed (because on saving a new record it only needs to be checked against the currently 'IsCurrent'-flagged record), and for retrieving the current record no further comparison is necessary. But how could I do this? I need to update the "AddRecord"-SP with this comparison, but I don't know how to do this.
Currently number 2 is my favorite, I just don't know how to do it ;-) What is your opinion about it, and could you include an example?
Thanks
View 20 Replies
View Related
Mar 12, 2008
Hello,
I would like to find all the records that contain only digits. So far, I have this:
SELECT *
FROM tmp1
WHERE (word LIKE N'[0-9]')
It returns only ten results, each containing a single digit. What I need is to find all the records of any length containing only digits, like '378', '2005', etc. but not records containing both digits and other stuff (e.g. letters) like 'I95' or 'P2P'.
Any idea?
Cornelius
View 7 Replies
View Related
Dec 5, 2006
Version: Microsoft SQL Server 2000 - 8.00.2040 (Intel X86)
Problem:
Server: Msg 8964, Level 16, State 1, Line 1
Table error: Object ID 515532920. The text, ntext, or image node at page (1:377289), slot 1, text ID 897099563008 is not referenced.
Server: Msg 8964, Level 16, State 1, Line 1
Table error: Object ID 515532920. The text, ntext, or image node at page (1:377447), slot 1, text ID 897100939264 is not referenced.
<... and 4 same errors>
DBCC results for 'CC_Document'.
The repair level on the DBCC statement caused this repair to be bypassed.
<same messages>
The repair level on the DBCC statement caused this repair to be bypassed.
There are 192 rows in 6 pages for object 'CC_Document'.
CHECKTABLE found 0 allocation errors and 8 consistency errors in table 'CC_Document' (object ID 515532920).
repair_allow_data_loss is the minimum repair level for the errors found by DBCC CHECKTABLE (crmproded.dbo.CC_Document repair_fast).
I won't run checktable with 'repair_allow_data_loss' before all records aren't find out
I try run DBCC PAGE on this pages. It print info
PAGE: (1:377289)
----------------
BUFFER:
-------
BUF @0x01249540
---------------
bpage = 0x2928A000 bhash = 0x00000000 bpageno = (1:377289)
bdbid = 8 breferences = 0 bstat = 0x9
bspin = 0 bnext = 0x00000000
PAGE HEADER:
------------
Page @0x2928A000
----------------
m_pageId = (1:377289) m_headerVersion = 1 m_type = 3
m_typeFlagBits = 0x0 m_level = 0 m_flagBits = 0x8000
m_objId = 515532920 m_indexId = 255 m_prevPage = (0:0)
m_nextPage = (0:0) pminlen = 0 m_slotCnt = 2
m_freeCnt = 3742 m_freeData = 4446 m_reservedCnt = 0
m_lsn = (19116:290571:12) m_xactReserved = 0 m_xdesId = (0:0)
m_ghostRecCnt = 0 m_tornBits = 856438469
Allocation Status
-----------------
GAM (1:2) = ALLOCATED SGAM (1:3) = NOT ALLOCATED
PFS (1:372048) = 0x42 ALLOCATED 80_PCT_FULL DIFF (1:6) = NOT CHANGED
ML (1:7) = NOT MIN_LOGGED
Blob fragment at: Page (1:377289) Slot 0 Length: 4266 Type: 3 (DATA)
Blob Id:897099563008
2928A06E: 7fe8108f 64a115ed 245a1a1a b68e502c .......d..Z$,P..
<blob fragment ... >
2928B0FE: 00006278 00006e87 00007ad1 xb...n...z..
Blob fragment at: Page (1:377289) Slot 1 Length: 84 Type: 4 (LARGE_ROOT_2)
Blob Id: 897099563008 Level: 0 MaxLinks: 5 CurLinks: 5
Child fragment at Page (1:377237) Slot 0 Offset: 8080
Child fragment at Page (1:377238) Slot 0 Offset: 16160
Child fragment at Page (1:377239) Slot 0 Offset: 24240
Child fragment at Page (1:377288) Slot 0 Offset: 32320
Child fragment at Page (1:377289) Slot 0 Offset: 36572
There are 5 links at Slot 1 , that's generate error. But why? What does it mean - "The text, ntext, or image node at page (1:377289), slot 1, text ID 897099563008 is not referenced" ???
I saw other pages (not 'broken') - there is: Blob Fragment don't contains links - links are in other pages.
What are these 'broken' records in my example - they are chunks of lost information, that i can't recover?
Or not? May be exists a way, that i find all 'broken' records? Because, my table contains 192 records. But there is BLOB field - and i can't check consistency of every file, that uploaded in my table. In addition I will fully appreciate this problem.
At last, if i find record, i run checktable with repair_allow_data_loss, then upload file again.
p.s. These errors contained in backup too.
View 7 Replies
View Related