# sql: Scan error on column index 1: converting driver.Value type string ("hello") to a int: invalid syntax

- **ID:** `go/database-sql-rows-scan-type`
- **Domain:** go
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The database returned a value that cannot be converted to the target Go type during Scan, often due to schema mismatch.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.16 | active | — | — |
| 1.20 | active | — | — |

## Workarounds

1. **** (85% success)
   ```
   Scan into an intermediate type and convert: var tmp string; rows.Scan(&tmp); val, _ := strconv.Atoi(tmp)
   ```
2. **** (90% success)
   ```
   Use sql.NullInt64 to handle nullable/invalid values: var n sql.NullInt64; rows.Scan(&n); if n.Valid { val := n.Int64 }
   ```

## Dead Ends

- **** — May not be feasible in production or requires migration. (60% fail)
- **** — Leads to incorrect data handling and potential bugs. (80% fail)
