sql-server

Cannot see foreign key constraints on SQL Server 2008

Hi, Bit rusty on the sql side as I have not touched in a while I have added a foreign key constraint using the Diagram and clearly says that there is a fk relationship. However when scripting the table or viewing the keys in SQL Server explorer I cannot see the grey key. Am I missing something? Not sure I am doing it correctly. How ...

Buffer and cache Difference ?

can annbody detail - Whatis the difference between Buffer and Cache in system memory ? ...

32bit OSQL issue with 64bit Windows+64bit SQL Server

I have a Windows 2008 x64 server and with SQL Server 2008 x64 installed. osql.exe under SQL Server directory could list instances with -L. I copied osql.exe+osql.rll from another SQL Server 2005 x86 and '.\osql.exe -L' returns error like "[ODBC Driver Manager] Data source name not found and no default driver specified". After check reg...

Audit two different tables in SQL Server

Hi All, I have a form with data. Any changes or insertion , those data should be updated in tow different tables like name, salary in one table and address, mail id in another table. Like the example above i have several columns in both tables. Now i want to audit the table. So i think i have to create a view for the two tables and se...

Run SQL Server temporarily on notebook

I have the occasional need to run SQL Server on my notebook computer. 90% of the time I connect to our dev SQL server, but there are times (ie: offsite) where it would be helpful to have access while programming. If I install SQL Server (I need the full version, since our databases are larger than the max allowed by SQL Server Express)...

How do I get a SQL function to return a list to be used by the IN statement in a WHERE clause?

Hey guys I have a complex SQL Query, that needs to be filtered further. Part of the WHERE clause looks like this: Where P.PeriodID in (36, 37) I need to get it to look more like this: Where P.PeriodID in dbo.GetPeriodsInRange(@startDate, @endDate) The function must return a list of PeriodIDs to be used by the IN statement. I reall...

how to connect the asp.net web application to kannel SMS gateway?

I have a project assigned in which whatever mail alerts be generated sent as a sms to the user who is using that web application.I want to know that how to use kannel as a SMS gateway to connect to my Web application and what are the steps required? Can anybody help me on this topic? I want some Documentation regarding this topic...... ...

Need help with a SQL query selecting date ranges from a table of period quarters

Hi. I have a table called Periods that looks like this PeriodID | PeriodYear | PeriodQuarter 7 | 2009 | 1 8 | 2009 | 2 9 | 2009 | 3 10 | 2009 | 4 11 | 2010 | 1 12 | 2010 | 2 Each row in the table represents 1 of the 4 quarters of the year (like 3-monthly school terms). E.g. The first row represents Period 1 of 2009 (i.e. the dat...

Sql Server, find all rows that have been updated by a statement

Is there a way of finding all the rows that have been updated by a single statement, sql itself must be tracking this as it could roll back the update if required. I'm interested in finding all the changed rows as I'm getting performance hit using update triggers. I have a some large (2M-10M) row tables in Sql Server, and I'm adding aud...

Single If Statement needs Begin & End in code block

I ran into this a bit ago and was wondering why the "Begin" & "End" is need to result in correct values. the if statement(s) is a singleton and does not require the "Begin" & "End" where multiple statements in the if would require it and if omitted would generate an execution error when trying to create/alter the procedure. Any ideas...

SQL Server, Can a T-SQL operator be used like a variable ? Or something like that

What I want to do is something like this DECLARE @operator nvarchar; SET @operator = 'AND' SELECT * FROM MyTable WHERE first_column = "1" @operator second_columnt = "2" is there a way to implement a logic like that one ? ...

TSQL How to see contents of Check Constraint on SQLServer

Is there a TSQL script that will allow me to see the contents of a constraint. I found a question regarding Oracle but I need a TSQL script. http://stackoverflow.com/questions/2686353/how-to-see-contents-of-check-constraint-on-oracle I am aware of sys.check_constraints, however, the 'definition' comes back null for all objects. Selec...

SQL Server 2005 Stored Procedure Dependencies

Hello I have a list of stored procedures and I'm trying to determine the order they should be implemented in. Is there a way to determine how the stored procedures are dependent on each other. I'm thinking that I could use sysobjects and syscomments. Thanks ...

SQL Server Agent error - Connection "DatabaseName" is not found??

Some modifications were made to an SSIS package and I can't seem to figure out what is wrong. The SQL server agent job which involves execution of one of these packages was running fine until a couple of days ago. The error I am seeing is this... Executed as user: domainname\serviceaccount. ... for 32-bit Copyright (C) Microsoft Cor...

SQL statement to select the value of the latest version of data based on the latest date

I have a simple query and am wondering if it could be more elegantly coded. The final solution has to be ansi-compliant. I need to fetch the latest value from a table based on date and version. A sample would explain more clearly: declare @t table (id int, due_date smalldatetime, version int, value nvarchar(10)) insert into @t select ...

Visio 2003 ERM to SQL Server script

Hello, my question is simple: Is there anyway to generate the database sql creaton script from a Visio 2003 model? I prefer Visio, however can be other program (freeware) that allows me to somehow agilize the process between the model and the sql code. Thanks in advance! ...

Where clause on a column that's a result of a UDF

I have a user defined function (e.g. myUDF(a,b)) that returns an integer. I am trying to ensure this function will be called only once and its results can be used as a condition in the WHERE clause: SELECT col1, col2, col3, myUDF(col1,col2) AS X From myTable WHERE x>0 SQL Server tries to detect x as column, but it's really an...

SQL Server login failure in middle of application run

I have an application that suddenly started throwing the following exception: System.Data.SqlClient.SqlException: Login failed for user 'username'. The username and password are correct and the app does some queries/inserts using the same login before throwing the exception. What are some other reasons a login can start failing? ...

Custom WordBreaker for SQL Server Full-text

Hi Does anyone have information on how to create a custom word breaker for SQL Server 2005. I'd prefer to write it in c#. I need to be able to search on terms such as 'c#', 'f#' etc but the '#' character is a word breaker in the English (UK) word breaker component and can't be changed in any other way. I have found the following articl...

Entity Framework 4 column conversions - SQL Server - SQLite

I have a SQL Server database and Entity Framework Model setup with POCO objects, this is working fine. However, I have also created a Sqlite database from the SQL Server database (using a simple conversion process). So I have created another EDMX file for the SQLite database, which I would like to use my existing POCOs generated from t...