Showing posts with label array. Show all posts
Showing posts with label array. Show all posts

Thursday, March 22, 2012

can varchar(max) store images in sql ?

If you serialize the image into a string ? If you want to save a byte array to a string, do you have to use a base64 encoded string ?

sql server can store binary objects directly, thats probably a much better solution, unless you have very specific requirements?sql

Thursday, March 8, 2012

Can sql variable accept array?

Hi,
Can sql variable accept array?
regards,
florencehttp://www.algonet.se/~sommar/arrays-in-sql.html
"florence" <florencelee@.visualsolutions.com.my> wrote in message
news:110d01c3a21c$07657720$a301280a@.phx.gbl...
> Hi,
> Can sql variable accept array?
> regards,
> florence|||Florence,
SQL Server do not support array of values. You may have to pass comma seperated values to the code.
Refer to following url for more information.
Passing arrays to stored procedure
http://www.algonet.se/~sommar/arrays-in-sql.html
- Vishal|||http://www.algonet.se/~sommar/arrays-in-sql.html
--
Jacco Schalkwijk
SQL Server MVP
"florence" <florencelee@.visualsolutions.com.my> wrote in message
news:110d01c3a21c$07657720$a301280a@.phx.gbl...
> Hi,
> Can sql variable accept array?
> regards,
> florence|||http://www.aspfaq.com/2248
"florence" <florencelee@.visualsolutions.com.my> wrote in message
news:110d01c3a21c$07657720$a301280a@.phx.gbl...
> Hi,
> Can sql variable accept array?
> regards,
> florence

Wednesday, March 7, 2012

Can SQL break an array into one string? [Stored Procedure]

Hello, I have a question on sql stored procedures.
I have such a procedure, which returnes me rows with ID-s.
Then in my asp.net page I make from that Id-s a string like

SELECT * FROM [eai.Documents] WHERECategoryId=11 ORCategoryId=16 ORCategoryId=18.

My question is: Can I do the same in my stored procedure?
Here is it:

set ANSI_NULLSONset QUOTED_IDENTIFIERONgoALTER PROCEDURE [dbo].[eai.GetSubCategoriesById](@.Idint)ASdeclare @.pathvarchar(100);SELECT @.path=PathFROM [eai.FileCategories]WHERE Id = @.Id;SELECT Id, ParentCategoryId,Name, NumActiveAdsFROM [eai.FileCategories]WHERE PathLIKE @.Path +'%'ORDER BY Path

Thank you
Artashes

There is no Array in Stored procedure, but you do can it by use dynamic sql . pass stored procedure a string as 11,16,18

then

in store procedure do

exec N'select * from yourTable where id in ' + @.idlist

Hope this help

|||

DavidDu thank you for answer. I found another solution.

It is herehttp://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=475225&SiteID=1

Artashes