Script out - Create Table structure
Hi All,If i rightclick a table and script out, i ll get the create table query as shown below:Create Table Table_name(Column1 Datatype1,Column2 Datatype2)Question : Is there any way to get this Create...
View ArticleUsing ISNULL in CASE statement
Hi,I need to write a query that will gimme the resultsets based on a data comparison with some values, Those values that are null in the result set needs to be replaced with an empty string which can...
View ArticleDelete all rows from a temporary table except those meeting a selection criteria
I have a temporary table #SearchTbl in my procedure that is filled with data. I have a SELECT statement that selects some of the data from #SearchTbl. Instead of putting the selected data into a new...
View ArticleT sql query help to calculate trend.
Hello Forum Members,I need to calculate the trend.Trend=Supply +Next Supply-Next...
View ArticleHow to check when new column got added in the table?
I would like to know, how to check when new column got added in the table? and who created that?Rahul
View ArticleLooking for suggestion/idea/help WITH T-SQL
Hi all,The scenario I have is a person can have one or more charges on his/her case. One charge could be adjudicated as GUILTY and the other charge is DROPPED. If this is the scenario, I would like to...
View Articlequery help
I wanted to see if someone could help me add Logic to a dataset query in a SSRS project that is controlled by a parameter.When a user selects a parameter I would like the dataset to exclude 6 different...
View ArticleI want a select statement to return two values, sum of one column and...
I have two columns one called invoice_number and the other invoice_amount. I want a select statement to return two columns.... invoice_number and then the sum of the invoice_amount(s) for each unique...
View ArticleChanging a Value in a table via a query
I'm using SQL server report builder to build a report. One of the reports I am trying to create, there is a column called "Job Status". In this column can be FT, PT, PRN. What we need is for each of...
View ArticleOperand data type date is invalid for subtract operator.
Hi,I need to write a function that returns the age of the users in years. I need precise age, so a simple datediff(yy, ..) is not suitable.The problem is that the database has unrealistic data as well...
View Articleerror message: Conversion failed when converting the varchar value 'G001985'...
Here is my script:select name_id, physican_id, primary_name, last_name, first_name from dbo.tblphysiciannameswhere (physician_id = 'G001985')How to convet the varchar va;e tp data type int?Thank you...
View Articlewhy row_number() is not generating continuous numbers
Hello Experts,I have :selectrow_number()over(partitionbycityorderbydate)rno,but I get the following:rno 1 4 7 10 14 18 20 25 28 31 33 36 39 42Please advise me.
View ArticleDeciphering bitwise flags
I read the article below and believe it to be a good fit for what I'm trying to do. I'm having a little trouble interpreting how it applies to my...
View ArticleInvalid results after SS2012SP2 installed
After several days of testing in development environment we rolled out SQL Server 2012 SP2. Server is running great in production and GDI+ errors have stopped from randomly showing up. Now after a week...
View ArticlePrecision of SQRT and POWER
Hello everybody,followingDECLARE @arg AS DECIMAL(38, 19) = 25000000000000.000100SELECT POWER(@arg, 0.5) AS power_result ,SQRT(@arg) AS sqrt_resultreturns 5000000 though 5000000.00000000001 would be...
View ArticleHelp with Window Functions
Hi all,I need some help in getting rid of a very slow cursor operation. I have three tables:1. Consignments 2. Labels 3. ConsignmentReferencesLabels table has a foreign key to Consignments....
View ArticleHelp needed in sqlservers connection
Hi, I have two database in different servers and i need to access one db object in another db. for ex, server1 (db1) and server2(db2(tableA,tableB) ) I will be writing a stored procedure in in db1 and...
View ArticleScript Quote Issue
Hi Guys, Below you will see my script that I'm trying to put together which enumerates through a stored variable(3 letter strings) and incorporates them into an update script; however, I am having a...
View ArticleInserting data into various 15 minutes buckets
Hi,I am using SQL 2005.I have a requirement where I am getting the date column from source as a string (eg., 20140707065749, in yyyymmddhhmmss format).For each hour, I will be having 4 tables of 15...
View ArticleHelp with like in sql
Hi all, I am having an issue with like statement with full text searchMy data : BEAN PEELER SQL STATEMENT: Select * from table where col1 like '%[^a-z]peeler[^a-z]%' doesn't give all the results...
View Article